Advertisement
Guest User

Untitled

a guest
Jan 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <form action="test.php" method="POST">
  2. Name:<input type="text" name="name"><br/>
  3. Email Id:<input type="email" name="email"> <br/>
  4. Phone Number:<input type="number" name="phone"> <br/>
  5. <input type="submit" value="Submit">
  6. </form>
  7.  
  8.  
  9. <?php
  10. $host='localhost';
  11. $user='root';
  12. $pass='';
  13. $db='amrit';
  14.  
  15. $name=$_POST['name'];
  16. $email=$_POST['email'];
  17. $phone=$_POST['phone'];
  18. echo "$name $email $phone";
  19.  
  20. $conn = mysqli_connect($host,$user,$pass,$db);
  21.  
  22. $query = "insert into data(Name,Email,Phone) values('$name','$email','$phone')";
  23.  
  24. $result= mysqli_query($conn,$query);
  25.  
  26. if($result===TRUE){
  27. echo "Data Inserted";
  28. }
  29. else{
  30. echo "Error";
  31. }
  32. mysqli_close($conn);
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement