Jump to content

Recommended Posts

Posted

Code I am trying to run:

 

><?PHP
if (isset($_POST['stage']) && ('process' == $_POST['stage']))
{
process_form();
} else {
print_form();
}

function print_form()
{
echo <<< END
  <form action="$_SERVER[PHP_SELF]" method="post">
  First Name?
 <input type="text" name="first_name">
 <input type="submit" value="Submit">
 <input type="hidden" name="stage" value="process">
 </form>
 END;
}

function process_form()
{
echo 'Hello ' . $_POST['first_name'] . '!';
}

?>

Can anyone explain why I don't get an error and the Source lists only:

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

Funny I don't ever see PHP errors anymore, instead, I get blank pages with the same source listed above.

Posted (edited)

The terminator for the heredoc must be the first thing on the line imediatly followed by the ;

 

you have a space in front of the terminator.

 

 

>echo <<< END
 <form action="$_SERVER[PHP_SELF]" method="post">
 First Name?
<input type="text" name="first_name">
<input type="submit" value="Submit">
<input type="hidden" name="stage" value="process">
</form>
 END;
}

 

 

remove space above before END

Edited by TCH-Don
Posted

*Slaps Forehead Repeatedly*

 

Thanks! I killed myself for hours over that!

 

I wish I would have goten some error messages to help out; instead, all I got was a blank screen. THAT was annoying!

 

Bow to master....

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...