...

View Full Version : Cases with Multiple Form Submissions



CoolAsCarlito
01-16-2009, 02:16 AM
My form posts the data to the same page. Since there are multiple forms that could be submitted to the same page I need to have logic to determine which form is submitted. I would first create a switch to determine which form was submitted checking for a particular POST value. I need to create a hidden field on each form to identify the form.:


if(isset($_POST)
{
//Form was submitted - determine the form
switch($_POST['formID'])
{
case "form1":
processForm1();
$page="xxx.php";
break;
case "form2":
processForm1();
$page="yyy.php";
break;
}
}

The $page value would represent which content to show in the page when it reloads. Although this may be different based upon the outcome of the form processing (i.e. form passed, form had invalid data, etc.)

So, now that I have a value ($page) to determine what content to show I could simply include it by default in the page.



<div id=content>
<?php
if ($page)
{
include($page);
}
?>
</div>

A1ien51
01-16-2009, 04:14 AM
And your question is?

CoolAsCarlito
01-16-2009, 04:16 AM
I'm sorry. Just wondering if it looks good the form of it and all and if it does what should it be put for formid.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum