Phumlani M
New member
what is wrong wit it? Am using XAMPP on windows XP
php code
register.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Registration</title>
</head>
<body>
<h1>Register</h1>
<form action="insert.php" method="post">
<p>First Name:<br>
<input type = "text" name = "firstN"/>
</p>
<p>Last:<br>
<input type = "text" name = "lastN"/>
</p>
<p>Business Name:<br>
<input type = "text" name = "busName"/>
</p>
<p>Email:<br>
<input type = "text" name = "e_mail"/>
</p>
<p>Contact Number:<br>
<input type = "text" name = "contactNo"/>
</p>
<p>Username:<br>
<input type = "text" name = "uname"/>
</p>
<p>Password:<br>
<input type = "password" name = "passw"/>
</p><br>
<input type = "button" name = "add" value = "Submit" />
</form>
</body>
</html
insert.php
?php
if (isset($_POST['add'])){
$lh = "localhost";
$uname = "root";
$passw = "";
$db = "fivestep";
$con = mysql_connect($lh, $uname, $passw);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("fivestep", $con);
$sql = "INSERT INTO t_user(u_id, firstName, lastName, busName, eAddress, contactNo, uname, passw)
VALUES ('', $_POST[firstN]', '$_POST[lastN]', '$_POST[busName]', '$_POST[firstN]', '$_POST[e_mail]', '$_POST[contactNo]', '$_POST[uname]', '$_POST[passw]')";
mysql_query($sql, $con) or die('Error: ' . mysql_error();
echo "1 row added";
mysql_close($con);
}
?>
php code
register.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Registration</title>
</head>
<body>
<h1>Register</h1>
<form action="insert.php" method="post">
<p>First Name:<br>
<input type = "text" name = "firstN"/>
</p>
<p>Last:<br>
<input type = "text" name = "lastN"/>
</p>
<p>Business Name:<br>
<input type = "text" name = "busName"/>
</p>
<p>Email:<br>
<input type = "text" name = "e_mail"/>
</p>
<p>Contact Number:<br>
<input type = "text" name = "contactNo"/>
</p>
<p>Username:<br>
<input type = "text" name = "uname"/>
</p>
<p>Password:<br>
<input type = "password" name = "passw"/>
</p><br>
<input type = "button" name = "add" value = "Submit" />
</form>
</body>
</html
insert.php
?php
if (isset($_POST['add'])){
$lh = "localhost";
$uname = "root";
$passw = "";
$db = "fivestep";
$con = mysql_connect($lh, $uname, $passw);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("fivestep", $con);
$sql = "INSERT INTO t_user(u_id, firstName, lastName, busName, eAddress, contactNo, uname, passw)
VALUES ('', $_POST[firstN]', '$_POST[lastN]', '$_POST[busName]', '$_POST[firstN]', '$_POST[e_mail]', '$_POST[contactNo]', '$_POST[uname]', '$_POST[passw]')";
mysql_query($sql, $con) or die('Error: ' . mysql_error();
echo "1 row added";
mysql_close($con);
}
?>