Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_GET['action']) && isset($_GET['ID'])){
- $action=$_GET['action'];
- $ID=$_GET['ID'];
- if($action=='add'){
- $btn='Save';
- $row=null;
- }else if($action='edit'){
- $connection=mysqli_connect('localhost','root','','escala_exer4');
- $sql="SELECT * FROM registration WHERE ID=".$ID;
- $result=mysqli_query($connection,$sql);
- $row=mysqli_fetch_array($result);
- $btn='Update';
- }
- }
- else{ $row=null;}
- ?>
- <html>
- <head>
- <title>User Registration</title>
- <link type = "text/css" href="exer4.css" rel="stylesheet">
- </head>
- <body>
- <center>
- <form action="exer4_main.php?action=<?php echo $action?>&ID=<?php echo $ID ?>" method="POST">
- <form>
- <center><h1>User Registration</h1></center>
- please complete the following form to register with our site:<br><br>
- <div>UserName:</div><div class="a"><input type="text" name="username" value="<?php echo $row['username'] ?>"></div><br>
- <div>Password:</div><div class="a"><input type="password" name="password" value="<?php echo $row['password'] ?>"></div><br><br>
- <?php
- $genders=array("Male", "Female");
- ?>
- <div>Gender:</div><div class="a"><input type="radio" name="gender" value="male">Male</div><br>
- <div> </div><div class="a"><input type="radio" name="gender" value="female">Female</div><br><br><br>
- <div class="dist3">How did you hear about us?:</div>
- <?php
- $sources=array("Select Answer", "Friends", "Through the internet", "advertisments","newspaper","Family")
- ?>
- <div class="a"><select name="source" value="<?php echo $row['source']?>">
- <?php
- foreach($sources as $source) { ?>
- <option><?php echo $source ?> </option>
- <?php }?>
- </select></div>
- <br><br><br>
- <div>Please select this box if you wish</div>
- <div class="b"> to be added to our mailing list</div>
- <input type="checkbox" name="mailing" value="yes">
- <br>
- <div class="d"> We will not pass on your details to any third party.</div>
- <br><br><br><br>
- <div class="b"> </div><div class="c"><input type='submit' value='<?php
- if(isset($btn)){
- echo $btn;
- }
- else{ echo "Register Now";
- } ?>'
- /></div>
- </form></center>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement