Guest User

Untitled

a guest
Feb 1st, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2. $host="localhost";
  3. $user="root";
  4. $pwd="";
  5. $db="mohita";
  6.  
  7. $conn=mysqli_connect($host,$user,$pwd,$db) or die("unable to connect");
  8. ?>
  9.  
  10. <html>
  11. <head>
  12. <title>Try here</title>
  13. </head>
  14.  
  15. <body>
  16. <form method="post">
  17. <input type="text" name="yourname"/>
  18. <input type="email" name="mailid"/>
  19. <input type="password" name="mypass"/>
  20. <input type="number" name="phn"/>
  21. <textarea rows="5" cols="20" name="address"/></textarea>
  22. <input type="submit" name="reg"/>
  23. </form>
  24. </body>
  25. </html>
  26.  
  27. <?php
  28. if(isset($_POST['reg'])){
  29. $yourname=$_POST['yourname'];
  30. $mailid=$_POST['mailid'];
  31. $mypass=$_POST['mypass'];
  32. $phn=$_POST['phn'];
  33. $address=$_POST['address'];
  34.  
  35. $query="insert into login(Name,Email,Pass,Mobile,Address) values('$yourname','$mailid','$mypass','$phn','$address')";
  36.  
  37. $run=mysqli_query($conn,$query);
  38.  
  39. if($run){
  40. echo "<h1>Data submitted successfully</h1>";
  41. }
  42.  
  43. else{
  44. echo "<h1>Failed to submit data</h1>";
  45. }
  46. }
  47. ?>
Add Comment
Please, Sign In to add comment