SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Non-Member
    Join Date
    Feb 2001
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am fairly new to PHP and the following is a script I found on http://php.resourceindex.com. It is a "Tell a friend" script which works perfectly but I need to change something, when the user hits the submit button it forwards them to a basic text page saying "thanks" this seems to be done by the ECHO section near the bottom of the script, I would like to change this so that it goes to a HTML/PHP page that I specify instead (friend_suc.html) :

    You can see exactly how the script currently works by going to http://gd.project77.net/friend.php

    <script language="php">
    $nameX = stripslashes($name);
    $to_nameX = stripslashes($to_name);
    $url = "http://www.randomportal.com";
    $message = "Hello $to_nameX,
    I think you would like $url";
    $subject = "$nameX wants you to check this site out";

    if (( $to_email_address) && ( $from_email_address)) {

    mail($to_email_address, $subject, $message,
    "From: $from_email_address
    Reply-To: $from_email_address
    X-Mailer: PHP
    Errors-To: $from_email_address");
    echo "Thank you"; <---- This is what I want to change
    } else {

    echo "error";
    }

    </script>

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Replace

    echo "Thank you"; <---- This is what I want to change

    with

    include("friend_suc.html");

    This will output the contents of friend_suc.html to the browser. If friend_suc.html contains php (and your server parses .html files) then it will process the php code in friend_suc.html as well.

  3. #3
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .....or,
    header("location:friend_suc.html");

    which will redirect to the relevant page,or

    header("refresh: 5; url=friend_suc.html");
    echo "Thank you";

    which will let people see the thankyou and then redirect.

  4. #4
    Non-Member
    Join Date
    Feb 2001
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyou very much, I have got it working exactly as I wanted it to


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
  •