Tech Support Guy banner

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

1140 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 - 1 of 4 Posts
I check like so:
PHP:
if( $_POST['submit'] && $_POST['submit'] != "" ) {
// then the form was posteed
}
else
 // it was not
1 - 1 of 4 Posts
Status
Not open for further replies.
Top