Results 1 to 8 of 8

Thread: Issue using "case" and redirect!

  1. #1
    Join Date
    Jan 2007
    Posts
    82
    Thanks
    30
    Thanked 18 Times in 17 Posts

    Default Issue using "case" and redirect!

    Please note, this is an old, existing post I am now having further problems with. This "simple" script is supposed to match a user inputted name, to a coresponding page.

    This code is now presenting me with a problem in IE, and I can't for the life of me figure out why!? I am using a page called registry.php, here's the code:

    PHP Code:
    <?php
        
    if(isset($_POST['Submit'])){
            
    $name strip_tags($_POST['name']);
            
    $name strtolower($name);
            switch(
    $name){
                case 
    "haynes":
                    
    $page 'haynes.html';
                break;
                case 
    "bill":
                    
    $page 'bill.html';
                break;
                case 
    "bart":
                    
    $page 'bart.html';
                break;
                default:
                    
    $page "noregistry.html";
                break;
            }
            
    header("Location:$page");
        }
    ?>
    And I am using the below form to post to the script.

    HTML Code:
    <form name="Submit" method="post" action="registry.php">
    <input type="text" name="name" class="cleardefault" size="20" value="Groom's Last Name" /><br />
    <font size="-2" color="#0099FF">(Use ALL lowercase letters)</font><br /><br />
    <input type="Submit" name="Submit" value="Submit" />
    </form>
    It works in firefox, and upon original testing, it worked in IE. Now when I test in IE it takes me to the registry.php page and stops. The script does not redirect to the appropriate case or page.

    Here's the live example:
    www.damartravel.com/honeymoons.html
    You can see the form in the left hand column.

    Here's the direct link to the page it should redirect to:
    www.damartravel.com/haynes.html

    Hopefully this is something silly, and one of you know what it is! lol... It's been driving me crazy all morning.

    Thanks in Advance.

  2. #2
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    I just went to the site in Both Firefox and IE and it worked fine for me, when i put haynes in the box.

    I get page not found on both bart and bill
    Ryan
    Sevierville, TN

  3. The Following User Says Thank You to NXArmada For This Useful Post:

    tonyking (03-28-2008)

  4. #3
    Join Date
    Jan 2007
    Posts
    82
    Thanks
    30
    Thanked 18 Times in 17 Posts

    Default

    Odd, may I ask what version of IE you used? As I've tried this on several computers in our office producing the same results.

  5. #4
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    It worked fine for me in IE7.

  6. The Following User Says Thank You to JazzcatCB For This Useful Post:

    tonyking (03-28-2008)

  7. #5
    Join Date
    Jan 2007
    Posts
    82
    Thanks
    30
    Thanked 18 Times in 17 Posts

    Default

    Very weird, I'm testing on IE7 myself, and have used multiple computers in our office. I hate just saying oh well, and moving on, but at this point I don't know what to do. Hopefully it works for everyone but me??

  8. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What if you replaced:
    PHP Code:
            header("Location:$page"); 
    With:
    PHP Code:
            header("Location: ".$page); 
    Jeremy | jfein.net

  9. The Following User Says Thank You to Nile For This Useful Post:

    tonyking (03-28-2008)

  10. #7
    Join Date
    Jan 2007
    Posts
    82
    Thanks
    30
    Thanked 18 Times in 17 Posts

    Default

    I FIGURED IT OUT!!!! Sort of.... Atleast I have narrowed it down! Nile I appreciate the reply, I tried that and it resulted in the same thing, BUT!

    I have discovered when I click the submit button everything works fine in IE. However, when the user presses 'Enter' and submits the form, IE users (atleast IE7 users) are directed to a blank registry.php page. Why and how I don't freakin know, but I don't think it's an issue with the php, possibly the javascript I am using to clear the default text in the box?

    Thanks everyone for your help, I've transfered this to the Javascript forum. Hopefully I can get this bug fixed there!

    New Thread:
    http://www.dynamicdrive.com/forums/s...ad.php?t=30905
    Last edited by tonyking; 03-28-2008 at 09:50 PM.

  11. #8
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    Quote Originally Posted by tonyking View Post
    Odd, may I ask what version of IE you used? As I've tried this on several computers in our office producing the same results.
    I am using IE7
    Ryan
    Sevierville, TN

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •