Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Tell-A-Friend

  1. #1
    Senior Member Seldimi's Avatar
    Join Date
    Dec 2002
    Location
    Kozani, Greece
    Posts
    488
    Member #
    409
    I want to create a Tell-A-Friend Script. I made the html page but I wan't to make the php one (sending script) right now. What should I write so as to have multiple receivers ???
    - Webmaster's Planet . Greek Vortal For Webmasters ...
    - MyPortFolio - View My Creations

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You can create multiple text boxes with the same name, split the request by a comma, and loop through the resultant array.

    Here's a cool tutorial for making a dynamic textbox form:

    http://www.webdesignforums.net/showt...&threadid=7940

  4. #3
    Senior Member Seldimi's Avatar
    Join Date
    Dec 2002
    Location
    Kozani, Greece
    Posts
    488
    Member #
    409
    I have the textboxes I need. I don't know how to make the php script get all these emails and send them the text from a textbox.
    - Webmaster's Planet . Greek Vortal For Webmasters ...
    - MyPortFolio - View My Creations

  5. #4
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Try...
    PHP Code:
    <?php
    $name 
    $_POST['nametextbox'];
    $to $_POST['emailtextbox'];
    $comments $_POST['commentstextarea'];
    $subject "Your friend $name would like to show you something...";

    $message =
    "Your friend $name wants you to visit
    http://www.whatever.com/.\n\n
    He/She has also left you this message\n\n----------------\n\n
    $comments";

    if (
    mail($to$subject$message)) {
    header("location: 'successfile.php');
    } else {
    header("
    location'failiurefile.php');
    }
    ?>
    JR

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    What are your textboxes named? You'll need to loop through all of them somehow. Can you post a link to your form so we can make this thing work for multiple emails?

    Thanks

  7. #6
    Senior Member Seldimi's Avatar
    Join Date
    Dec 2002
    Location
    Kozani, Greece
    Posts
    488
    Member #
    409
    Here is the html fine on attachement
    (It is a simple interface, I will change it after I try to finish the .php file )
    - Webmaster's Planet . Greek Vortal For Webmasters ...
    - MyPortFolio - View My Creations

  8. #7
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    PHP Code:
    <?php
    $name 
    $_POST['nametextbox'];
    $emails $_POST['emailtextbox'];
    $comments $_POST['commentstextarea'];
    $subject "Your friend $name would like to show you something...";

    $message =
    "Your friend $name wants you to visit
    http://www.whatever.com/.\n\n
    He/She has also left you this message\n\n----------------\n\n
    $comments";

    if (empty(
    $name || $to || $comments))
    {
        
    header("location: 'failiurefile.php'");

    else
    {
        
    $seperated explode(","$emails);
        
    $arraysize sizeof($seperated);
        for (
    $i 0$i $arraysize;)
        {
            if (
    mail($seperated[$i], $subject$message)) {
                
    $i++;
            } else {
                
    header("location: 'failiurefile.php'");
            }
            
    header("location: 'successfile.php'");
        }
    }
    ?>
    You would be better adding the comments as a textarea.

    This script that I made gets the e-mails they entered into a textarea (the e-mails are seperated with commas) and makes them seperate.
    JR

  9. #8
    Senior Member Seldimi's Avatar
    Join Date
    Dec 2002
    Location
    Kozani, Greece
    Posts
    488
    Member #
    409
    I will do a better layout. I made it in 1 minute only to upload it here
    Thanx for your time guys, I really appreciate it :cheeky:
    - Webmaster's Planet . Greek Vortal For Webmasters ...
    - MyPortFolio - View My Creations

  10. #9
    Senior Member Seldimi's Avatar
    Join Date
    Dec 2002
    Location
    Kozani, Greece
    Posts
    488
    Member #
    409
    Sth more...
    I will have to make it
    $emails = $_POST['sender1,sender2,sender3']; (etc ?)
    - Webmaster's Planet . Greek Vortal For Webmasters ...
    - MyPortFolio - View My Creations

  11. #10
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    No, add a text area like so...
    Code:
    <textarea name="emailtextbox"></textarea>
    Then tell the user to seperate the e-mails by commas ,.
    JR


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:47 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com