Advertisement
Guest User

Untitled

a guest
Mar 31st, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1.  
  2. <HTML>
  3. <BODY>
  4. <?php
  5.  
  6. $sid=$_GET['sid'];
  7. echo "<br> Student id is ".$sid;
  8. $username="u216";
  9. $password="Rohini123?";
  10. $dbname="u216";
  11. $conn=mysqli_connect('localhost',$username,$password,$dbname);
  12. $query="SELECT * FROM student WHERE sid='$sid'";
  13. $result=mysqli_query($conn,$query);
  14. $row=mysqli_fetch_array($result);
  15. ?>
  16. <form name="f2" method="POST" action="">
  17. <br> Name
  18. <input type="text" name="name" value=<?php echo $row['name'];?> >
  19. <br>
  20. Gender
  21. <input type="radio" name="gender" value="male"
  22. <?php if($row['gender']=="male") echo "CHECKED";?>
  23. > Male
  24. <input type="radio" name="gender" value="female"
  25. <?php if($row['gender']=="female") echo "CHECKED";?>
  26. > Female
  27. <br> Department<br>
  28. <select name="dept">
  29. <option value="IT"
  30. <?php if($row['dept']=="IT") echo "SELECTED";?>
  31. >
  32. Information Technology</option>
  33. <option value="Business"
  34. <?php if($row['dept']=="Business") echo "SELECTED";?>
  35.  
  36. >Business Department</option>
  37. <option value="Engineering"
  38. <?php if($row['dept']=="Engineering") echo "SELECTED";?>
  39.  
  40. >Engineering Department</option>
  41. </select>
  42. <br>Information<br>
  43. <textarea name="info">
  44. <?php echo $row['info'];?>
  45. </textarea>
  46. <br>
  47. <input type="submit" name="update1" value="Update ">
  48. </form>
  49. <?php
  50. if(isset($_POST['update1']))
  51. {
  52. $name=$_POST['name'];
  53. $gender=$_POST['gender'];
  54. $dept=$_POST['dept'];
  55. $info=$_POST['info'];
  56. $sql="update student set name ='$name',gender='$gender', dept='$dept'
  57. ,info='$info' where sid='$sid'";
  58. echo "<br>".$sql;
  59. $result=mysqli_query($conn,$sql);
  60.  
  61.  
  62.  
  63. }
  64.  
  65.  
  66. ?>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement