Is dat mean I have connection problem to the database or there is something else?? However, I did not receive any error message that told me any connection problem or any other error appears.
This is the PHP codes namely register.php that I use:
Code: Select all
<?php
include ("connect.php");
if (!isset($_POST['Proceed'])) {
submitData();
}
function submitData(){
$name = $_POST['requiredname'];
$studID = $_POST['requiredstudentID'];
$pword = $_POST['pw1'];
$programme = $_POST['requiredprogramme'];
$yearsem = $_POST['requiredyearsem'];
$gender = $_POST['gender'];
mysql_select_db($database) or die($errCon . mysql_error());
//Insert input into database
mysql_query("INSERT INTO $table
(requiredname, requiredstudentID, pw1, requiredprogramme, requiredyearsem, gender)
VALUES('$name', '$studID','$pword','$programme', '$yearsem', ' $gender') ")
or die($errCon . mysql_error());
echo "Data Inserted!";
}
?>and this is the connection file which i use namely connect.php:
Code: Select all
<?php
//<!-- DATABASE CONNECTION INFO---->
$errCon = "<br> Contact your webmaster. <br>";
$hostname="localhost";
$mysql_login="root";
$mysql_password="";
$database="myfyp";
$table= "account";
//&dbtype="MySQL";
// connect to the database server
mysql_connect($hostname, $mysql_login, $mysql_password)
or die($errCon . mysql_error());
// select a database
mysql_select_db($database) or die($errCon . mysql_error());
?>and the html file that i use for the form is register.html:
Code: Select all
<title>Account Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body background="utplogo.jpg">
<h1> Account Registration</h1>
<p>Please fill in the information to register for your account:</p>
<form name= "Proceed" method = "post" action = "register.php">
<p><label>Name:
<input name = "requiredname" type = "text" size = "40" />
</label></p>
<p><label>Student ID
<input name = "requiredstudentID" type = "int" size = "15">
</label></p>
<p><label>Password :
<input name = "pw1" type = "password" size = "15">
</label></p>
<p><label>Programme: <select name= "requiredprogramme" >
<option> Please select one </option>
<option>Mechanical Engineering</option>
<option>Electrical & Electronic Engineering</option>
<option> Chemical Engineering</option>
<option> Civil Engineering</option>
<option> Information Technology</option>
<option> Information System</option>
</select>
</label></p>
<p><label>Year / Semester: <select name= "requiredyearsem" >
<option> Please select one </option>
<option>Foundation Year / 1st Sem</option>
<option>Foundation Year / 2nd Sem</option>
<option> Year 2 / Sem 1</option>
<option> Year 2 / Sem 2</option>
<option> Year 3 / Sem 1</option>
<option> Year 3 / Sem 2</option>
<option> Year 4 / Sem 1</option>
<option> Year 4 / Sem 2</option>
<option> Year 5 / Sem 1</option>
<option> Year 5 / Sem 2 </option>
</select>
</label></p>
<p><label> Gender:
<input type = "radio" name = " gender" CHECKED/> Male
<input type = "radio" name = " gender" />Female
</label>
</p>
<br><br>
<p>
<input type = "submit" name = "Proceed" value = "Proceed" style = "height:35px; width: 120px"/>
<input type = "reset" name = "Reset" value = "Reset" style = "height:35px; width: 120px"/>
</p>
</form>
</body>
</html>I really hope someone can help me with this problem coz I continually received the blank page even though i have tried to do some appropriate changes.
Thank You very much.