Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2005, 12:51 AM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ismnanie Send a message via Yahoo to ismnanie
Default 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.
 
Old March 17th, 2005, 08:20 AM
Registered User
 
Join Date: Feb 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1. you must use javascript, cause php ise server-side language...

2. you need to call header("Location: somepage.htm") to redirect to another page...






Similar Threads
Thread Thread Starter Forum Replies Last Post
click the button above and redirect another page crmpicco Perl 2 November 16th, 2006 08:46 AM
Page display based on radio button selected Mekala HTML Code Clinic 3 July 10th, 2004 06:12 AM
Radio Button activates a selection box in the page rnerilla JSP Basics 0 April 23rd, 2004 12:14 AM
Radio button activates a selection box in the page rnerilla PHP How-To 1 April 22nd, 2004 01:41 PM
Passing value in select box to another page Bandy PHP How-To 5 February 11th, 2004 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.