Jump to content


This topic is now archived and is closed to further replies.


form problem

Recommended Posts

When I submit my form, a blank page is returned back with no content.  The form should post back to itself.  (The 'action' attribute is the same page)

I have the following code at the top of the page:

[tt]if(isset($_POST['postback']) && $_POST['postback']=='y' ){
echo "page posted back";}
else {
echo "page did not post back";

And within my form I have:

[tt]<input type="hidden" name="postback" value="y">[/tt]

When I first load the page, "page did not post back" is found on the top of the page.

However when I submit the form, no content is returned at all.  Any suggestions?  ???

Share this post

Link to post
Share on other sites
Your snippet looks fine to me.
If you are doing this just to determine wether a form is posted or not in general, you could sniff for the submit button instead - saving you the trouble of hidden fields:


  echo "Form is posted";

echo <<<_HTML

<form method="post" action="test.php">
<input type="text" name="q" />
<input type="submit" name="submit" value="Post this form" />




Share this post

Link to post
Share on other sites


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.