<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="#" method="post">
UserName: <input type="text" name="username"><br />
Passward: <input type="text" name="passward"><br />
Name: <input type="text" name="name">
<input type="submit" name="Submit" value="Sent">
</form>
<?php
$con=mysql_connect("localhost","root","","firstphp");
if(isset($_POST['Submit']))
{
$UserName = $_POST['username'];
$Password = $_POST['passward'];
$Name = $_POST['name'];
$sql="INSERT INTO users (username, passward, name)
VALUES ($UserName, $Password, $Name, NOW())";
$result = mysql_query($sql);
if (mysql_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
/*if($result){
echo "pass";
}
else {
echo "ERROR" . mysql_error($con);
}*/
mysql_close();
}
?>
</body>
</html>
Nabeel_1 0 Newbie Poster
Nabeel_1 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
peeyush.budhia 0 Newbie Poster
Nabeel_1 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
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.