radio button, select box, redirect page
a.php
<form name="form" action="b.php">
<p>
<label>
<input type="radio" name="RadioGroup1" value="Food">
Food</label>
<select name="food99" size="1">
<option value="burger">Burger</option>
<option value="pizza">Pizza</option>
</select>
<br>
<label>
<input type="radio" name="RadioGroup1" value="Sports">
Sports</label>
<select name="sports99" size="1">
<option value="basketball">Basketball</option>
<option value="swimming">Swimming</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<br>
</p>
</form>
The form is saved in a.php . i thought <input type="radio" name="RadioGroup1" value="<select name="food" .. . . </select>"> will work, but it caused many errors. i want the second select box(sports) is disabled when the user selects radiogroup1="Food".
In b.php,
if the user select <input type="radio" name="RadioGroup1" value="Food">, the value of "food99" will send to c.php.
Otherwise, the value of "sports99" will send to d.php
i found an ASP example from wrox's book-Beginning ASP 3.0 page 280.
PageChoice.html
<form name="form" action="choosepage.asp" method="POST">
<input type="radio" name="RadioGroup1" value="page1"
checked>Page 1<br>
<input type="radio" name="RadioGroup1" value="page2">
Page 2<p>
<input type="submit" name="Submit" value="Submit">
</form>
in choosepage.asp
<%
Option Explicit
Dim strChoice
strChoice = Request.Form("PageChoice")
If strChoice = "Page" Then
Response.Redirect "page1.html"
Else
Response.Redirect "page2.html"
End If
%>
So there will be page1.html, page2.html.
I just wonder if php can do like that.
|