<head>
<?php
if ((@$_POST["tutor_id"]=="") && (@$_POST["password"]=="")&& (@$_POST["name"]=="")&& (@$_POST["hp_num"]=="") && (@$_POST["email_add"]=="") && (@$_POST["mathF1"]=="") && (@$_POST["mathF2"]=="") && (@$_POST["mathF3"]=="") && (@$_POST["mathF4"]=="") && (@$_POST["mathF5"]=="") && (@$_POST["snF1"]=="") && (@$_POST["snF2"]=="") && (@$_POST["snF3"]=="") && (@$_POST["addMathF4"]=="") && (@$_POST["addMathF5"]=="") && (@$_POST["phyF4"]=="") && (@$_POST["phyF5"]==""))
{
?>
<script type=text/javascript>
function check()
{
if ((form.tutor_id.value=="") || (form.password.value=="")|| (form.name.value=="")||(form.hp_num.value=="") ||(form.email_add.value=="") || (form.mathF1.value=="") || (form.mathF2.value=="") || (form.mathF3.value=="") || (form.mathF4.value=="") || (form.mathF5.value=="") || (form.snF1.value=="") || (form.snF2.value=="") || (form.snF3.value=="") || (form.addMathF4.value=="") || (form.addMathF5.value=="") || (form.phyF4.value=="") || (form.phyF5.value==""))
{
alert("Fill all the empty spaces. THANK YOU");
return false;
}
else
return true;
}
</script>
<?php
}
?>
<title>WAWASAN TUITION CENTRE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body,td,th {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 16px;
}
.style1 {font-size: xx-small}
body {
margin-left: 80mm;
margin-top: 0mm;
margin-right: 30mm;
margin-bottom: 50mm;
background-color:#5CB3FF
}
.style2 {font-size: 24px}
.style3 {font-size: 16px}
-->
</style>
</head>
<body>
<table width="814" height="400" border="1">
<tr>
<td colspan="3"><p><img src="picture/header image.png" width="963" height="241"></p>
</td>
</tr>
<tr>
<td colspan="1"><div align="right"><a href="admin_logout.php">LOGOUT</a></div></td>
</tr>
<tr>
<td> <div align="center" class="style2">
<p>TUTOR REGISTRATION FORM </p>
</div></td>
</tr>
<tr>
<td width="245" bgcolor="#8CC6C6"><div align="center">
<form action="tutor_reg2.php" method="post" name="form">
<table width="484" border="1" align="center">
<tr>
<td><div align="center"><strong>TUTOR ID</strong></div></td>
<td><input name ="tutor_id" type="hidden" size="50"></td>
</tr>
<tr>
<td><div align="center"><strong>TUTOR NAME</strong></div></td>
<td><input name ="name" type="text" size="50"></td>
</tr>
<tr>
<td><div align="center"><strong>PASSWORD </strong></div></td>
<td><input name ="password" type="password" size="50"></td>
</tr>
<tr>
<td><div align="center"><strong>HANDPHONE NUMBER </strong></div> </td>
<td><input name="hp_num" type="text" size="50"></td>
</tr>
<tr>
<td><div align="center"><strong>EMAIL ADDRESS</strong></div></td>
<td> <input name ="email_add" type="text" size="50" ></td>
</tr>
<tr>
<td><div align="center"><strong>SUBJECT LIST</strong></div></td>
<td> <input name="mathF1" type="checkbox" value="mathF1" />
MATHEMATICS FORM 1<br />
<input name="mathF2" type="checkbox" value="mathF2" /> MATHEMATICS FORM 2 <br />
<input name="mathF3" type="checkbox" value="mathF3" /> MATHEMATICS FORM 3<br />
<input name="mathF4" type="checkbox" value="mathF4"> MATHEMATICS FORM 4<br />
<input name="mathF5" type="checkbox" value="mathF5" /> MATHEMATICS FORM 5<br />
<input name="snF1" type="checkbox" value="snF1" /> SCIENCE FORM 1<br />
<input name="snF2" type="checkbox" value="snF2" /> SCIENCE FORM 2<br />
<input name="snF3" type="checkbox" value="snF3" /> SCIENCE FORM 3<br />
<input name="addMathF4" type="checkbox" value="addMathF4" /> ADDITIONAL MATHEMATICS FORM 4<br />
<input name="addMathF5" type="checkbox" value="addMathF5" />
ADDITIONAL MATHEMATICS FORM 5<br />
<input name="phyF4" type="checkbox" value="phyF4" />
PHYSICS FORM 4<br />
<input name="phyF5" type="checkbox" value="phyF5" /> PHYSICS FORM 5<br /> </td>
</tr>
<tr>
<td colspan="5"><div align="center" class="style9">
<div align="center">
<input type="submit" name="Submit" value="SUBMIT">
<input type="reset" name="Submit2" value="RESET">
</div>
</div></td>
</tr>
</table></form>
<tr>
<td colspan="2"><div align="center"><a href="index.html"><img src="picture/home icon.jpg" width="109" height="70" border="0" align="middle"></a></div></td>
</tr>
<tr>
<td colspan="3"><div align="center" class="style1">COPYRIGHT © WAWASAN TUITION CENTRE by PRAVINA @ UNITEN 2012 </div></td>
</tr> </table>
</body>
</html>
and PHP code
<?php
include 'connect_db.php';
if ((@$_POST["tutor_id"]=="") && (@$_POST["password"]=="")&& (@$_POST["name"]=="")&& (@$_POST["hp_num"]=="") && (@$_POST["email_add"]=="") && (@$_POST["mathF1"]=="") && (@$_POST["mathF2"]=="") && (@$_POST["mathF3"]=="") && (@$_POST["mathF4"]=="") && (@$_POST["mathF5"]=="") && (@$_POST["snF1"]=="") && (@$_POST["snF2"]=="") && (@$_POST["snF3"]=="") && (@$_POST["addMathF4"]=="") && (@$_POST["addMathF5"]=="") && (@$_POST["phyF4"]=="") && (@$_POST["phyF5"]==""))
{
?>
<script>
alert("Fill all the empty spaces. THANK YOU");
window.location.href="tutor_reg.php";
</script>
<?php
}
else if(strlen($_POST['hp_num'])!=10)
{
?>
<script>
alert("INVALID NUMBER. IT SHOULD BE IN THE LENGTH OF 10");
window.location.href="tutor_reg.php";
</script>
<script type="text/javascript">
function validate_form ( )
{
valid = true;
if (form.email_add.value.indexOf("@", 0) < 0)
{
window.alert("Please enter a valid e-mail address.");
valid = false;
}
}
</script>
<?php
}
else{
$tutor_id = $_POST['tutor_id'];
$password = $_POST['password'];
$name = $_POST['name'];
$hp_num = $_POST['hp_num'];
$email_add = $_POST['email_add'];
$mathF1 = $_POST['mathF1'];
$mathF2 = $_POST['mathF2'];
$mathF3 = $_POST['mathF3'];
$mathF4 = $_POST['mathF4'];
$mathF5 = $_POST['mathF5'];
$snF1 = $_POST['snF1'];
$snF2 = $_POST['snF2'];
$snF3 = $_POST['snF3'];
$addMathF4 = $_POST['addMathF4'];
$addMathF5 = $_POST['addMathF5'];
$phyF4 = $_POST['phyF4'];
$phyF5 = $_POST['phyF5'];
$var = $_POST['whatever'];
$result = mysql_num_rows(mysql_query("SELECT * FROM tutor WHERE tutor_id= '$tutor_id'"));
$mymax = mysql_num_rows(mysql_query("SELECT * FROM tutor"));
$mymaxid = $mymax;
$pad_length = 3;
$item = str_pad($mymax, $pad_length, '0', STR_PAD_LEFT);
if($result == 1)
{
echo '<h1>ERROR!</h1>The userid you have chosen already exists!';
}
else
{
mysql_query("INSERT INTO tutor (tutor_id, password,name ,hp_num,email_add,mathF1,mathF2,mathF3,math4,math5,snF1,snF2,snF3,addMathF4,addMathF5,phyF4,phyF5) VALUES ('T$item','$password', '$name','$hp_num','$email_add','$mathF1','$mathF2','$mathF3' ,'$mathF4','$mathF5','$snF1','$snF2','$snF3','$addMathF4','$addMathF5','$phyF4','$phyF5')");
}
echo '<!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>
<title>WAWASAN TUITION CENTRE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body,td,th {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 16px;
}
.style1 {font-size: xx-small}
body {
margin-left: 80mm;
margin-top: 0mm;
margin-right: 30mm;
margin-bottom: 50mm;
background-color:#5CB3FF
}
.style2 {font-size: 24px}
.style3 {font-size: 16px}
-->
</style>
</head>
<body>
<div id="right">
<div align="right">
</div>
<div id="thumbnails">
<p align="right"></p>
<p align="center">Congratulations! You have successfully registered as a tutor!
<p>Click <a href="admin_main_page.php">here</a> admin main page.</p>
<p> </p>
<p> </p>
</div>
<p> </p>
<h2 align="left"> </h2>
</div>
</div>
</body>
</html>' ;
?>
<?php
}
?>
**** I HAVE PROBLEM WITH CHECKBOX WHERE i CAN'T CHOOSE MORE THEN 1 BOX.. AND I TRY TO FIX IT BUT FAILED
CAN ANYONE HELP ME, I HAVE BEEN FIX THE ERROR PAST FEW DAYS BUT I DUNNO WHERE IS THE ERROR
MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!!
:code;
This post has been edited by JackOfAllTrades: 31 July 2012 - 09:22 AM

New Topic/Question
Reply



MultiQuote







|