Skip to content

Instantly share code, notes, and snippets.

@ptmaroct
Created January 26, 2017 16:39
Show Gist options
  • Select an option

  • Save ptmaroct/aa675df439db704e03e7c43d6adb5ee8 to your computer and use it in GitHub Desktop.

Select an option

Save ptmaroct/aa675df439db704e03e7c43d6adb5ee8 to your computer and use it in GitHub Desktop.
<form action="test.php" method="POST">
Name:<input type="text" name="name"><br/>
Email Id:<input type="email" name="email"> <br/>
Phone Number:<input type="number" name="phone"> <br/>
<input type="submit" value="Submit">
</form>
<?php
$host='localhost';
$user='root';
$pass='';
$db='amrit';
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
echo "$name $email $phone";
$conn = mysqli_connect($host,$user,$pass,$db);
$query = "insert into data(Name,Email,Phone) values('$name','$email','$phone')";
$result= mysqli_query($conn,$query);
if($result===TRUE){
echo "Data Inserted";
}
else{
echo "Error";
}
mysqli_close($conn);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment