Drop down menu redirection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Im having some troubles.  When a user selects a topic from a drop down
I want it so that when they click submit it brings them to a
corresponding html page

so if they select plumbing then hit submit take then to plumbing.html

How do i pass variables to the header fucntion

Re: Drop down menu redirection

Rob wrote:
Quoted text here. Click to load it

$allowed_pages = array(

if (isset($_POST['topic'])) {
  $var = $_POST['topic']; /* ex. 'plumbing' */
  if (in_array(strtolower($var), $allowed_pages)) {
    header('Location: http://yourserver.com /' . $var);
    exit('Redirected to <a href="' . $var . '">' . $var . '</a>.');
  } else {
    /* Uh! Oh! */
    /* user is messing with the form */
    /* either re-show form or ban the user :-) */
/* user didn't select a topic */
/* re-show form, maybe with a error field */


Remember to *NOT* output anything to the browser before the header()
call or it will give an error and fail to redirect the browser.

Mail to my "From:" address is readable by all at http://www.dodgeit.com /
== ** ## !! ------------------------------------------------ !! ## ** ==
may bypass my spam filter. If it does, I may reply from another address!

Site Timeline