SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 6th, 2004, 02:42 PM
treelo treelo is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 118 treelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 59 sec
Reputation Power: 2
dropdown to redirect?

im trying to create a dropdown menu, then a button at the bottm, once the button is pressed the form directs me to the relevant page

here is the code i have so far, im getting pretty stuck and confused

php Code:
Original - php Code
  1. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
  2. search all world title records<br>
  3. <select name="weight">
  4.       <option value="heavy">Heavyweight</option>
  5.       <option value="cruiser">Cruiserweight</option>
  6.       <option value="lightheavy">Light Heavyweight</option>
  7.     </select>
  8. <br>
  9. <input type="submit" value="Go">
  10. <br>
  11. <br>
  12. </form>


anyone help me out here?

ive also been told that i need to use header in the page im being directed to

any help would be great

Reply With Quote
  #2  
Old March 6th, 2004, 03:26 PM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 507 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 2 sec
Reputation Power: 2
Send a message via AIM to bluephoenix
RE: dropdown to redirect?

The page that receives the form's values should check the value, determine the redirect page and then use header() to perform the redirect.

There is an entry in the FAQ list.

Just note that the redirect/header must be used before if there is any out put by the page that performs the redirect. Even if there is a space that gets sent before the header, the script will error out.

-Tim

Reply With Quote
  #3  
Old March 6th, 2004, 03:35 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: dropdown to redirect?

Enjoy:
php Code:
Original - php Code
  1. <?php
  2. $arrVals  = array(
  3. "heavy"=>"http://domian.com/heavy.htm",
  4. "cruiser"=>"http://domian.com/cruiser.htm",
  5. "lightheavy"=>"http://domian.com/lightheavy.htm"
  6. );
  7. if($_POST['submit'])
  8. {
  9.     $weight = $_POST['weight'];
  10.     $url = $arrVals[$weight];
  11.     header("Location: $url");
  12. }
  13. ?>
  14. <form action="<?=$_SERVER['PHP_SELF']?>" METHOD="POST">
  15. search all world title records<br>
  16. <select name="weight">
  17.       <option value="heavy">Heavyweight</option>
  18.       <option value="cruiser">Cruiserweight</option>
  19.       <option value="lightheavy">Light Heavyweight</option>
  20.     </select>
  21. <br>
  22. <input type="submit" name="submit" value="Go">
  23. </form>

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > dropdown to redirect?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway