Results 1 to 5 of 5

Thread: very new to php... link question

  1. #1
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default very new to php... link question

    I'm very new to php.
    For a website I created I want the users to be able to sent a string to an email address and when they are done, to be redirected to another page (html-page).

    I created a html page with a form that calls a php page. Both scripts work perfectly, but for now they just give a message after sending.
    How can I replace the "echo" to make the script go to another html-page?
    I'm learning from th "php5 and MySQL bible", but i can't find this anywhere... yet


    <form method="post" action="masc.php">
    A name for our mascotte...<br>
    <input type="text" size="30" name="Mascotte"><br>
    <input type="submit" name="Submit" value="Send"><br>
    </form>
    <?php
    $Mascotte = $_POST['Mascotte'];
    $formsent = mail('mascotte@email.com','Name Mascotte',$Mascotte);
    if ($formsent) {
    echo "Thanks!";
    } else {
    echo "try again";
    }
    ?>
    Last edited by Rohan72; 01-30-2007 at 09:10 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    header('Location: url');
    OR
    echo a meta tag--
    echo '<meta http-equiv="refresh" content="0;newurl">
    Note that '0' is delay, in seconds.... 5= 5 seconds, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I tried both options.

    header leaves me with a blank page (no matter what page i refer to),
    and the echo - meta combo gives me an endless reloading of the current php-page.

    I also tried the fopen() command... same result as header.

    Here are both complete pages.

    http://www.bluearmyneerpelt.be/mascotte.html
    <<html>
    <head>
    <title>Mascotte</title>
    </head>

    <body>
    <form method="post" action="masc.php">
    Een gepaste naam voor onze mascotte...<br>
    <input type="text" size="30" name="Mascotte"><br>
    <br>
    <input type="submit" name="Submit" value="Verzend"><br>

    </form>

    </body>
    </html>

    http://www.bluearmyneerpelt.be/masc.php
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body>
    <?php
    $Mascotte = $_POST['Mascotte'];
    $formsent = mail('mascotte@testmail.be','Naam Mascotte',$Mascotte);
    // I didn't include my real mail, in order not to get tons of mails
    if ($formsent) {
    echo '<meta http-equiv="refresh" content="0; http://www.bluearmyneerpelt.be/">';
    } else {
    header('location: http://www.bluearmyneerpelt.be/mascotte3.html');
    }
    ?>
    </body>
    </html>

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Uh... the meta tag is weird then.
    You should be going to a NEW page, or, yes, it will keep refreshing (as says the name) at the interval in seconds.

    Location should work.

    Thoughts:
    1. There is NO SPACE in the meta tag. This may be the entire problem, and the browser doesn't see it correctly.
    2. the L in Location should be CAPITALIZED...
    3. Location and other headers WILL NOT FUNCTION if you have already sent any html/text data. The headers come first, then the content. You must do that at the TOP of your page, before the <html>... tags.

    See if either/both of those fix it.

    I hope this solves it. Note: I'm fairly out-of-it at the moment, so I'm just trying to be clear/coherent... not yelling at you.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    the Header still doesn't work..
    META was a mistake on my part... I forgot to put URL= in front of the actuall address.
    So.. problem solved

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
  •