Virajsinh

FormSubmit.php

Apr 2nd, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit']))
  3. {
  4.    
  5.     $uname = $_POST['username'];
  6.     $pass = $_POST['password'];
  7.     $gender = $_POST['gender'];
  8.     $ag = $_POST['age'];
  9.     $mail = $_POST['mail'];
  10.     $city = $_POST['city'];
  11.    
  12.     $con = mysqli_connect("localhost","root","","mscit");
  13.    
  14.     if(!$con)
  15.     {
  16.         die("Error".mysqli_error());
  17.     }
  18.    
  19.     //insert into table_name values('username','password','gender',00,'city','mail');
  20.     $dbq = "insert into login value('$uname','$pass','$gender',$ag,'$city','$mail')";
  21.    
  22.     mysqli_query($con, $dbq);
  23.    
  24.     echo "<p> Record Inserted.";
  25.    
  26.     mysqli_close($con);
  27. }
  28. else
  29. {
  30.     echo "Enter Details First.";
  31.     header('Location: Form.html');
  32. }
  33. ?>
Add Comment
Please, Sign In to add comment