What the webpage would do is after clicking "SUBMIT" button, a php script will be use to add records into my database. But for now i do not know where to put the "signupinsert.php" into the html and to make it run. I have try putting it at form action = "signupinsert.php".
The HTML
<!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>Text Processing</title>
<link type="text/css" rel="stylesheet" href="scripts/mainstyle.css" />
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="200"><img src="images/logo.png" /></td>
<td>
<div id='formbox'>
<form action="signupinsert.php" method="post">
<strong>User Account Request Form</strong><br /><br />
<table width="600" border="0">
<tr>
<td width="200">Name:</td>
<td><input name="name" type="text" size="30"/></td>
<td>Department:</td>
<td><input name="department" type="text" size="30"/></td>
</tr>
<tr>
<td width="200">E-mail Address:</td>
<td><input name="email" type="text" size="40"/></td>
<td></td>
<td></td>
</tr>
<tr>
<td width="200"><input name="submitbtn" type="button" value="Submit" /></td>
<td><input name="cancelbtn" type="button" value="Cancel" /></td>
<td></td>
<td></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>
The PHP Script "signupinsert.php" that connects the database and input some data
<html>
<body>
<?php
$con = mysql_connect("localhost:3306","root","12345678");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("team18", $con);
$sql="INSERT INTO userprofile (name, department, email_pk)
VALUES
('$_POST[name]','$_POST[department]', '$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
</body>
</html>
Please Help, im stuck in this for week and could not find the right solution to it.
Thanks