Re: submit form to php script problem

From: Date: Wed, 19 Jun 2002 12:48:43 +0000
Subject: Re: submit form to php script problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102916@lists.php.net to get a copy of this message
<form method=post action=""> <form vars> <input type=button value="Search" onClick="this.form.action='searchoutput.php'; this.form.submit();"> <input type=button value="Admin" onClick="this.form.action='adminoutput.php'; this.form.submit();"> <input type=button value="Add" onClick="this.form.action=addoutput.php'; this.form.submit();"> </form> "Mark Colvin" <mark.colvin@ccmltd.co.uk> wrote in message news:007601c2178d$713aed30$890aa8c0@ccmltd.co.uk... > 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 > > > **************************************************** > This e-mail is intended for the recipient only and > may contain confidential information. If you are > not the intended recipient then you should reply > to the sender and take no further ation based > upon the content of the message. > Internet e-mails are not necessarily secure and > CCM Limited does not accept any responsibility > for changes made to this message. > Although checks have been made to ensure this > message and any attchments are free from viruses > the recipient should ensure that this is the case. > ****************************************************

« previous php.general (#102916) next »