Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. //get the form elements and store them in variables
  4.  
  5. $name=$_POST["name"];
  6.  
  7. $addr=$_POST["addr"];
  8.  
  9. $email=$_POST["email"];
  10.  
  11. ?>
  12.  
  13. <?php
  14.  
  15. //establish connection
  16.  
  17. $con = mysqli_connect("192.168.2.1","wordpressuser","wordpresspass!","wordpress");
  18.  
  19. //on connection failure, throw an error
  20.  
  21. if(!$con) {
  22.  
  23. die('Could not connect: '.mysql_error());
  24.  
  25. }
  26.  
  27. ?>
  28.  
  29.  
  30. <?php
  31.  
  32. $sql="INSERT INTO `wordpress`.`wordpresstable2` ( `name` , 'addr', `email_id` ) VALUES ( '$name','$email')";
  33.  
  34. mysqli_query($con,$sql);
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement