Click to See Complete Forum and Search --> : action on form submittion


meme
08-16-2006, 04:49 PM
All,

I am not sure if this is a serverside/clientside question.

Is there a way in php to direct the user to different pages according to their selection in the form. I know there's one "action" field in html form, and that accepts one argument. But what I want is that the user gets directed to one of 2 pages depending on their choice in a dropdown box. is this possible?

Many thanks

bokeh
08-16-2006, 05:11 PM
what I want is that the user gets directed to one of 2 pages depending on their choice in a dropdown box. is this possible?No. A form can only have one action. It is possible for that action to produce different output depending on the values of submitted variables though.

meme
08-16-2006, 05:40 PM
Thanks,

do you mean the following possible within the action? I've tested it and the user stays on the same page regardless of input. may be there's something missing?

<TR><form <?php if ($_POST[user] .= 'admin') {"action = admin_sel.php";} else {"action = n_user_page.php";} ?> method=post>

<tr><td><select name = "user">
<option value='admin'>Administrator</option>
<option value='emp'>Employee</option>
</select></TD>
<td><input type=submit value=submit></td></tr>

bokeh
08-16-2006, 05:51 PM
No it's not what I meant but it would work if you used correct syntax and echoed the output.