Jump to content


Photo

form problem


  • Please log in to reply
2 replies to this topic

#1 edg322

edg322
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 18 October 2006 - 03:44 PM

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:

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


And within my form I have:

<input type="hidden" name="postback" value="y">

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

#2 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 18 October 2006 - 03:46 PM

Post all the form code please.
SA PHP Archives - www.phparchives.za.org

#3 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 18 October 2006 - 04:40 PM

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:

<?php

if(isset($_POST['submit']))
{
  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" />
</form>

_HTML;

?>






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users