Jump to content

Parse error: syntax error, unexpected $end in => can't find it


senca99

Recommended Posts

hey,

I get this error on line 69 which is the end of my code, but I just can't find the missing or wrong curly bracket :s

 

<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<p>

<?php

if(isset($_POST['_submit_check'])){
if($form_errors = validate_form()){
	show_form($form_errors);}
else{
	process_form();}}
else{
show_form();}

function process_form(){
print "Hello, ".$_POST['user'];}

if(array_key_exists('user', $_POST)){
process_form();}
else{
show_form();
}
function validate_form(){
$errors = array();
if(strlen($_POST['user']) < 1){
	$errors[] = 'Your name must be at least 1 letter long.';
}
	return $errors;}

if(array_key_exists('_submit_check', $_POST)){
if(validate_form()){
	proces_form();
	}
else{
	show_form();}
}
else{
show_form();
	}

function show_form($errors = ''){
if($errors){
	print 'please correct these errors: <ul><li>';
	print implode('</li><li>', $errors);
	print '</li></ul>';
}

print<<<_HTML_
<form method = "POST" action="$_SERVER[php_SELF]">
Your name: <input type="text" name="user">
</br>
<input type="submit" value="Verzenden"/>
</br>
<input type="hidden" name="_submit_check_" value="1">
</form>
_HTML_;

}
?>

</p>
</body>
</html>

Link to comment
Share on other sites

Seemingly you're not allowed to indent the heredoc's closing tag. I suppose you learn something new each day.

<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<p>

<?php

if(isset($_POST['_submit_check']))
{
if($form_errors == validate_form())
{
	show_form($form_errors);
}
else
{
	process_form();
}
}
else
{
show_form();
}

function process_form()
{
print "Hello, ".$_POST['user'];
}

if(array_key_exists('user', $_POST))
{
process_form();
}
else
{
show_form();
}

function validate_form()
{
$errors = array();
if(strlen($_POST['user']) < 1)
{
	$errors[] = 'Your name must be at least 1 letter long.';
}

return $errors;
}

if(array_key_exists('_submit_check', $_POST))
{
if(validate_form())
        {
	proces_form();
}
else
{
	show_form();
        }
}
else
{
show_form();
}


function show_form($errors = '')
{
    if($errors)
    {
        print 'please correct these errors: <ul><li>';
        print implode('</li><li>', $errors);
        print '</li></ul>';
    }

    print<<<_HTML_
    <form method = "POST" action="$_SERVER[php_SELF]">
    Your name: <input type="text" name="user">
    </br>
    <input type="submit" value="Verzenden"/>
    </br>
    <input type="hidden" name="_submit_check_" value="1">
    </form>
_HTML_;
}
?>

</p>
</body>
</html>

 

There we go.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.