Advertisement
Guest User

Untitled

a guest
Feb 17th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <?php
  2. if(isset($_GET['action']) && isset($_GET['ID'])){
  3. $action=$_GET['action'];
  4. $ID=$_GET['ID'];
  5. if($action=='add'){
  6. $btn='Save';
  7. $row=null;
  8. }else if($action='edit'){
  9. $connection=mysqli_connect('localhost','root','','escala_exer4');
  10. $sql="SELECT * FROM registration WHERE ID=".$ID;
  11. $result=mysqli_query($connection,$sql);
  12. $row=mysqli_fetch_array($result);
  13. $btn='Update';
  14. }
  15. }
  16. else{ $row=null;}
  17. ?>
  18.  
  19. <html>
  20. <head>
  21. <title>User Registration</title>
  22. <link type = "text/css" href="exer4.css" rel="stylesheet">
  23. </head>
  24.  
  25. <body>
  26. <center>
  27. <form action="exer4_main.php?action=<?php echo $action?>&ID=<?php echo $ID ?>" method="POST">
  28. <form>
  29. <center><h1>User Registration</h1></center>
  30. &nbsp;&nbsp;please complete the following form to register with our site:<br><br>
  31. <div>UserName:</div><div class="a"><input type="text" name="username" value="<?php echo $row['username'] ?>"></div><br>
  32.  
  33. <div>Password:</div><div class="a"><input type="password" name="password" value="<?php echo $row['password'] ?>"></div><br><br>
  34.  
  35. <?php
  36. $genders=array("Male", "Female");
  37. ?>
  38.  
  39.  
  40. <div>Gender:</div><div class="a"><input type="radio" name="gender" value="male">Male</div><br>
  41. <div>&nbsp;</div><div class="a"><input type="radio" name="gender" value="female">Female</div><br><br><br>
  42.  
  43.  
  44.  
  45.  
  46. <div class="dist3">How did you hear about us?:</div>
  47.  
  48. <?php
  49. $sources=array("Select Answer", "Friends", "Through the internet", "advertisments","newspaper","Family")
  50. ?>
  51. <div class="a"><select name="source" value="<?php echo $row['source']?>">
  52. <?php
  53. foreach($sources as $source) { ?>
  54. <option><?php echo $source ?> </option>
  55. <?php }?>
  56. </select></div>
  57. <br><br><br>
  58. <div>Please select this box if you wish</div>
  59. <div class="b">&nbsp;to be added to our mailing list</div>
  60. <input type="checkbox" name="mailing" value="yes">
  61. <br>
  62. <div class="d">&nbsp;We will not pass on your details to any third party.</div>
  63. <br><br><br><br>
  64. <div class="b">&nbsp;</div><div class="c"><input type='submit' value='<?php
  65. if(isset($btn)){
  66. echo $btn;
  67. }
  68. else{ echo "Register Now";
  69. } ?>'
  70. /></div>
  71.  
  72. </form></center>
  73. </center>
  74. </body>
  75.  
  76.  
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement