Advertisement
Guest User

php

a guest
Feb 12th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "bit2018";
  6. //create connection
  7. $conn = mysqli_connect($servername,$username,$password,$dbname);
  8. //check connection
  9. if(!$conn)
  10. {
  11. die("connection failed: " . mysqli_connect_error());
  12. }
  13. if(isset($_POST['submitbtn']))
  14. {
  15. $std_fname = $_POST['std_fname'];
  16. $std_lname = $_POST['std_lname'];
  17. $std_roll = $_POST['std_roll'];
  18. $std_contact = $_POST['std_contact'];
  19. $std_address = $_POST['std_sddress'];
  20.  
  21. $sqlQuery = "INSERT INTO student_3rd (std_fname,std_lname,std_roll,std_contact,std_address)
  22. VALUES ('$std_fname','$std_fname','$std_roll','std_contact','$std_address')";
  23. if(mysql_query($conn,$sqlQuery))
  24. {
  25. $msg = "Information Inserted Succesfully";
  26. }
  27. else
  28. {
  29. $msg = "Problem in Inserting Data";
  30. }
  31. }
  32. ?>
  33. <h1 style="color:green"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement