Re: submit form to php script problem

From: Date: Wed, 19 Jun 2002 19:09:56 +0000
Subject: Re: submit form to php script problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102991@lists.php.net to get a copy of this message
Your idea will still work - send it to a script that reads the name of the submit button and then calls the processing code either as a function in the same file or from a file that you specify in an include or require statement in your processing file. The different processing scripts don't need to be separate 'pages' that you have to submit to. ..michael.. On Wed, 2002-06-19 at 05:32, Mark Colvin wrote: > I have a form with three submit buttons on it. I would like the form > 'action' to be dependant on which submit button the user pressed i.e. > redirect to one of three php script files. Is there any way of doing this > without using client side scripting? I tried the code below where $name > corresponds to one of the submit button names, but I realise this won't work > as the form would have to be sent to the server before $name could be > determined. Any other thoughts would be appreciated. > > <form action="<? > switch ($name) > { > case search: > ?>searchoutput.php<? > break; > case add: > ?>addoutput.php<? > break; > case admin: > ?>adminoutput.php<? > break; > } > ?>" method="post"> > > Thanks in advance > > Mark > >

« previous php.general (#102991) next »