I have this: If $content exists and form1 has been submitted then do something else if $content exists and form2 has been submitted then do something else else if $content exists do this. I would like this instead: if $content exists and no form has been submitted then do something If $content exists and form1 has been submitted then do something else else if $content exists and form2 has been submitted then do this. How do I check for "no form has been submitted"? Thanks!
inside the forms use <input type="hidden" name="form" value="1"> for form one and <input type="hidden" name="form" value="2"> for form two, then switch($_POST['form']) { case "1": //form 1 submitted break; case "2": //form two submitted break; //optional below default: // no forms submitted break; } PHP:
Yep, I understand that but that's not what I was asking. I want to reverse the sequence so the default is first. Thus I have to have an additional parameter along with default since it is always present. Any ideas?
I'm not sure I understand the question, so to answer : How do I check for "no form has been submitted"? if(!$_POST) { // no form submitted } sorry I just don't get it :S if u can think of a better explanation please post it ....or some actual code or the code ur trying to write that's needs fixing....
Not sure if this will help, but the submit buttons you are using have a name and value pair that is sent along with the form entries and is blank if no form is submited. for form 1 <Input type="submit" name="form" value="Continue"> for form 2 <Input type="submit" name="form" value="Go"> I use asp not php so i cant give code but i check this way. <% if request.form("form") = "" then Else if request.form("form") = "Continue" then Else if request.form("form") = "Go" then End if %> Code (markup): Hope this helps.