Thread: redirec ??

    #1
  1. No Profile Picture
    Gianni
    Guest
    Devshed Newbie (0 - 499 posts)
    can one redirect people to a url in with php3 ??


    I have a drop down list of states and i'd like to redirect people to url containing the state's names.
  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    header ("Location: /new/url/here");

    Like all headers it needs to be sent before any content.
  4. #3
  5. No Profile Picture
    Gianni
    Guest
    Devshed Newbie (0 - 499 posts)
    sorry to sound so stupid, but does
    the headr() go on the same page ? or do I make a .php3 and use it in the form action ?

    thank you
    Gianni
  6. #4
  7. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    You should make a second file that's pointed to by the ACTION part of the form declaration. Assuming the variable declared in the select box is $state this file would be very simple:

    <?
    $location="/path/to/".$state.".html";
    header("Location: $location);
    ?>
  8. #5
  9. No Profile Picture
    Gianni
    Guest
    Devshed Newbie (0 - 499 posts)
    thanks very much for your help

    I figured it out.

    I did point to a php file via action and placed the header() code in that and it worked.
    My mistake was to place it in the <.head> section and not right at the top.

    thank you very much for you help

    gianni

IMN logo majestic logo threadwatch logo seochat tools logo