Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Send blog link to a friend

Options
  • 26-09-2008 1:52pm
    #1
    Registered Users Posts: 8,070 ✭✭✭


    Hey Guys,
    Basically visitors can ADD friends.
    And under each post will be a link 'send to a friend' and they will be able to select who to send it to from a listbox.

    -Ive got the add and listbox being populated
    but having hard time grasping the concept of email being sent to several users,

    A- should i just modify this plugin
    http://www.lostpixels.nl/staf/
    it uses a .js script to send mails...

    B- It merely just sends a link, is it possible to send the article embed?

    thanks


Comments

  • Closed Accounts Posts: 1,200 ✭✭✭louie


    are you populating a multi-select menu or just a list inside a div?
    You can use checkboxes, multiselect menu and store them into an array, than loop through each one and sent the emails.
    You can also refence the article or post by ID in a hidden field, and before sending the email get the data from the DB.

    Is that what you are looking for?


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    thanks louie, im just doing it all from scratch, those plugins are useless !

    can someone help me out quickly, basically sending the blog/post url link as var and im reading it in the emailer php page

    so

    $num = $_GET;

    echos fine, but when i sent it in the body of the php mail function it arrives empty?

    [PHP]
    $friend_name = 'xxx';
    $friend_email = $tolist;


    $to = $friend_email;
    $from = $user_email;
    $subject = 'xxxx'
    $body = "this wont work".$test."wont work";

    $headers = "From: ".$from."\r\n" .
    "X-Mailer: php";
    [/PHP]


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    Not all of them are useless, but some just doesn't keep up with the blog updates.


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    well customising them is a bigger headache so best off doing it myself.
    edited post above ^ :)


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    are you sure, you are setting the url post to $test?
    It seems to me that is set as $num.


  • Advertisement
  • Registered Users Posts: 8,070 ✭✭✭Placebo


    sorry i tried
    doing $test = $num

    like i can echo num but it wont show in the body
    strange


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    can you show us the entire code for the email part?


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    thanks for this
    [PHP]<form action="list2.php" method="post">
    <select name="listbox[]" multiple="multiple" size=5>
    <option value="farzad.qasim@cognitivecorp.com">Cog Farz</option>
    <option value="qasimf@tcd.ie">Tcd Farz</option>

    </select><br />
    <input type="submit" />
    </form>



    <?php





    $addlist=$_REQUEST;
    if ($addlist){
    foreach ($addlist as $t)
    {
    $tolist .= $t.",";
    }
    }
    $tolist = substr($tolist,0,strlen($tolist)-1); // remove the trailing comma



    $num = $_GET;


    echo($num);



    $friend_name = 'xxx';
    $friend_email = $tolist;

    $to = $friend_email;
    $from = $user_email;
    $subject = "whatever";
    $body = $num;

    $headers = "From: ".$from."\r\n" .
    "X-Mailer: php";

    $success = 0;
    if(mail($to, $subject, $body, $headers)){
    $success = 1;
    }
    ?>[/PHP]


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    Add a hidden field to the form itself and set its value to the page URL.

    [php]

    <input type="hidden" name="c_url" id="c_url" value="<?php echo $_SERVER.$_SERVER;?> />

    //...then grab the post
    $num = $_POST;
    ..............
    [/php]


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    thanks for this louie, worked well, although after submit, the silly url reverts back to normal stage which means if someone trys to submit again, it wont have the URL stored.

    any way i can avoid this ? i really do need everything in same php file.


  • Advertisement
  • Closed Accounts Posts: 1,200 ✭✭✭louie


    store the url as a session and reset it ( session ) if the page gets refreshed.


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    thats worked great thanks man, shuda thought of it :(


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    You need a break from it, and it will come to you...


Advertisement