chinyy85
nOObee
Joined: 10 Aug 2005
Posts: 4
0 Cash
|
registerForm.php coding as follow
<?
$host='localhost';
$username='root';
$password='asd';
$connection = mysql_connect($host,$username,$password);
mysql_select_db("data");
$qualificationList = mysql_query ("SELECT * FROM admin_qualification");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form action="register.php" method="post" name="register_form" target="_parent" id="register_form">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr bgcolor="E5CF73">
<td colspan="2"><span class="style31">Personnal Information </span></td>
</tr>
<tr>
<td width="33%" bgcolor="#FFFFFF"><span class="style39">Chinese Name * </span></td>
<td width="67%"><input name="text_chinesename" type="text" id="text_chinesename"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style39">Surname * </span></td>
<td><input name="text_firstname" type="text" id="text_firstname"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style39">Last Name * </span></td>
<td><input name="text_lastname" type="text" id="text_lastname"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p class="style39">Qualification * </p> </td>
<td><select name="list_qualification" id="list_qualification">
<?
$counter = 0;
while ($row = mysql_fetch_array($qualificationList)) {
?>
<option value="<? echo $row["qualification"]; ?>"> <? echo $row["qualification"]; } ?>
</select> <span class="style49">
</table>
<p align="center">
<input name="Submit" type="submit" value="Submit" >
<input name="Reset" type="reset" id="Reset" value="Reset">
</p>
</form>
register.php coding as follow
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
$host = "localhost"; // hostname...in our case localhost
$username = "root"; // root is our default
$password = "asd"; // your mysql password please
$connection = mysql_connect("$host","$username","$password");
$select_success = mysql_select_db("data");
$chinesename = $_POST['text_chinesename'];
$firstname=$_POST['text_firstname'];
$lastname=$_POST['text_lastname'];
$Qualification=$_POST['list_qualification'];
if(empty($chinesename))
{
echo"Please make sure all the required field are being entered or chosen. //chinese name \n";
echo "Please back click to continue.";
//echo "</p>";
//echo "<a href='/register.html' onclick='self.history.back();'>Back</a>";
exit;
}
if(empty($firstname))
{
echo"Please make sure all the required field are being entered or chosen. //first name \n";
echo "Please back click to continue.";
//echo "</p>";
//echo "<a href='/register.html' onclick='self.history.back();'>Back</a>";
exit;
}
if(empty($lastname))
{
echo"Please make sure all the required field are being entered or chosen. //last name \n";
echo "Please back click to continue.";
//echo "</p>";
//echo "<a href='/register.html' onclick='self.history.back();'>Back</a>";
exit;
}
if(empty($Qualification))
{
echo"Please make sure all the required field are being entered or chosen. //qualification \n";
echo "Please back click to continue.";
exit;
}
else
{
mysql_query ("INSERT INTO user (chineseName, firstName, lastName,qualification) VALUES ('$chinesename', '$firstname', '$lastname', '$Qualification')");
echo "You have successfully register";
}
mysql_close();
?>
|