Okay,
inside my infopage is this line.
Code:
<? include( "/home/USERNAME/public_html/FORM_FILE_NAME.php" );?>
then inside my included file I have this
Code:
<?
$comments=stripslashes($comments);//needed during re-populate mode
if (!$formstatus=="submitted" || $frmerr=="retry"){
?>
<form method="POST" action="<? echo "$PHP_SELF"; ?>?main_page=infopages&pages_id=<? echo $pages_id;?>">
<input type=hidden name=formstatus value="submitted">
in my handler file (also included) I have this
Code:
if(!frmerr){ do whatever I need to do with this info}
else{
<form method="POST" action="<? echo "$PHP_SELF"; ?>?main_page=infopages&pages_id=<? echo $pages_id;?>">
<?
foreach($_POST as $var => $val) {?>
<input type=hidden name=<? echo "$var";?> value="<?echo stripslashes($val);?>" >
<?}?>
<input type=hidden name=frmerr value="retry" >
<input type=submit value="Correct This">
</form>
...}
Obviously you'll have to take care of frmerr (Form error) yourself, and deal with re-populating the fields if you want to prevent someone from needing to retype all their info when they leave one required field blank.
You'll need to replace 'infopages' with 'page' and 'pages_id' with 'id'.
Code carefully, I may have introduced errors when removing personally identifiable information from my code.
Bookmarks