Is there an easy/good way to process form data (i.e. suck the data out of the form and put in in a db) on the same page as the form itself? I don't like having to create a secondary page for the grunt work. There is a tutorial on webmonkey that is supposed to work, but I can't figure it out. Basically, it does the following
...
...
if ($submit) {
// process form
... pull out data
... put data in db
} else{
// display form
<form method="post" action="<?php echo $PHP_SELF?>">
... form stuff
<input type="Submit" name="submit" value="Enter information">
end if
...
...
Supposedly this is supposed to be smart enough to know if the form is calling itself via the if statement and the presence of value for $submit in the querysting. However, I can't get into the if section... I always get fed to the else block.
I've been working on this all afternoon, so by now I'm sure it's something silly/easy that I'm overlooking (got the coding blinders on). Any help is appreciated.