Re: forms -- which pah?

From: Date: Fri, 20 Oct 2000 15:53:58 +0000
Subject: Re: forms -- which pah?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21412@lists.php.net to get a copy of this message
Real GM Webmaster, You could use client side javascript. Maybe something like the following. Remember: javascript can be disabled. I'm not quite sure about location.href. Something like that should work. <html> <head> <script language=javascript> function redirect { if (document.form.Category_A.value > 0) { return true; } else { location.href="scenario2.php"; } } </script> </head> <body> <FORM ACTION="scenario1.php" METHOD=GET name="form" onSubmit="return redirect"> Alternately, you could make a php redirect page. It could be quite simple and more reliable than using javascript. Possibly: <?php if ($Category_A > 0) { header ("Location: scenario1.php"); } else { header ("Location: scenario2.php"); } ?> Cheers, Jeff "Real GM Webmaster" <db7@realgm.com> wrote in message news:000f01c03aa6$82b11780$0f02000a@c4e1w5... > > hi guys and gals, > > I have a problem with my form which has left me scratching my head. > > Up the top of my form I have my <FORM ACTION="scenario1.php" METHOD=GET>, but the problem is that the conditions that are/are not met during the execution of the form depends on which file will be fetched. > > For example, just say I have two different categories through my form, category A and category B. If Category B is > 0 (this value can only be derived through the execution of the form) then scenario2.php is the page I want to proceed, but if category B = 0 then scenario1.php should execute. > > If I have an if statement up the top of the page it does not take into account the values assigned to category B because the check has been made before the form has been executed. If I put this before my submit button at the end of the form, once everything is executed, then I lose all my details from above this if statement. > > Has anyone got any idea on how I can do this? > > Thanks In Advance. > > Michael > > Webmaster, > Real General Manager Inc. > http://www.realgm.com > > >

« previous php.general (#21412) next »