Tech Support Guy banner

PHP - Detecting whether the page was just submited to..

1139 Views 3 Replies 2 Participants Last post by  asbo
hey --

I'm trying to detect whether or not the page was just submitted to, and if it was, display something, and if it wasn't display a form to submit to it. Here's the code I have so far:
Code:
<html><body>
<br><center>
<table style="border: 2px red;" cellpadding="5"><tr><td>
<font face="tahoma" size="1">

<?php
if ($submit) {
  echo "You just submited the form!";
} else {
?>
  <form method="post" action="<?php echo $PHP_SELF ?>">
  First Field:&nbsp;<input style="font-family: verdana, arial, "ms sans serif", sans-serif; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1 solid #000000;" type="text" name="first"><br>
  Second Field:&nbsp;&nbsp;&nbsp;<input style="font-family: verdana, arial, "ms sans serif", sans-serif; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1 solid #000000;" type="text" name="second"><br><br>
  <center><input style="font-family: verdana, arial, "ms sans serif", sans-serif; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1 solid #000000;" type="Submit" name="submit" value="Do it!"><center>
  </form>
<?php } ?>

</td></tr></table></center>
</body></html>
I'm really new to PHP; can someone tell me what I'm doing wrong, and possibly point me to a good beginners tutorial as well?

Thanks,
asbo
See less See more
Status
Not open for further replies.
1 - 3 of 4 Posts
..I found an excellant page for forms and outside variables in PHP on the PHP.NET site that eluded my previous searches for whatever reason, but thought I'd share .. :here:

asbo
hey --

That's a lot simplier than I found; I used a hidden form element that was called submitted or something, and then just checked whether it equaled the right thing or not.


Thanks!
asbo
1 - 3 of 4 Posts
Status
Not open for further replies.
Top