Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to remove the following error: Parse error: syntax error, unexpected end of file in C:\wamp\www\PROJECT\y1.php on line 67

from the following code:

<html>
<head></head>
<body>

require "y_conn.php";
extract ($_GET);
$errorCount = 0;

$Name = validateInput($_POST['name'], "Name");
$Password = validateInput($_POST['password'], "Passowrd");
$Password1= validateInput($_POST['password1'], "Confirm Passowrd");
$Email= validateInput($_POST['e-mail'], "E-mail");
if ($errorCount>0){
echo "Please re-enter the information below.
\n";
redisplayForm($Name, $Password, $Password1, $Email);}
else
echo "Thank you for filling out the form";


function displayRequired($fieldName) {
echo "The field \"$fieldName\" is required.
";
}

function validateInput($data, $fieldName) {
global $errorCount;
if (empty($data)) {
displayRequired($fieldName);
++$errorCount;
$retval = ""; }
else { // Only clean up the input if it isn't empty
$retval = trim($data);
$retval = stripslashes($retval);
}
return($retval);
}

function redisplayForm($name, $password, $password1, $email) {
?>





<form method="get" action="y1.php">




Name:<input type="text" name="name" />
Password:<input type="password" name="password" />
Confirm Password:<input type="password" name="password1">
E-mail:<input type="text" name="e-mail" />
Age:<input type="text"name="age" />
<input type="submit" value="Done" /><input type="reset" value="reset" />

</form>


$q11= "SELECT * from `reg` ORDER BY `id`";
$q11_run= mysql_query($q11) or die(mysql_error());

$q12= "INSERT INTO `reg` (name,password,con. password,email,age)
VALUES ($name,$password,$password1,$e-mail,$age)";

?>


</body>
</html>
Posted
Updated 22-Jul-21 6:29am

This is not going to work. Just to mention a few:
1. incomplete pairing of php tags
2. incomplete function eg.
function redisplayForm($name, $password, $password1, $email) {

3. sql statements come out of no where.
4. ....

I suggest you help yourself to some tutorials. The following links should give you a good head start:
Learn HTML[^]
JavaScript[^]
Learn PHP+MySQL[^]
After the learning, you should be able to rewrite this code yourself.
If you encounter any problems with your learning or coding, then come here to post your question.
 
Share this answer
 
v4
connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO ESA_Mission (Astronaut, Mission,Targets )
VALUES ('Neil Armstrong', 'Gemini-8', 'successful')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "
" . $conn->error;
}



echo "Connected successfully";




?>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900