<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form name="entry" method='post' action="">
<label>NAME </label>
<input type="text" /></br></br>
<label>mobile</label>
<input type="text" /></br></br>
<input type="submit"/>
</form>
</body>
</html>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "demo";
// Create connection
$conn = mysql_connect($servername, $username, $password);
$db = mysql_select_db("demo");
// Check connection
if (! $con) {
die("Connection failed: " . mysql_error());
}
mysql_select_db("demo", $con) or die(mysql_error());
if ($_POST)
{
$name=$_POST['name'];
$mobile=$_POST['mobile];
$sql = "INSERT INTO demo(name, mobile)VALUES('$name','$mobile')";
}
if (!mysql_query($sql,$con))
{
die('Error: ' .mysql_error());
}
echo "1 record added";
echo "Connecter succesfully";
mysql_close($con);
?>
Ritika_1 0 Newbie Poster
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.