Grow your CSS skills. Land your dream job.

Send To A Friend form

  • # April 8, 2009 at 2:38 pm

    Hi All,

    I’ve been requested to create a "Send To A Friend" form for a client…can’t say I know entirely how to do this. Example:

    http://www.lee-associates.com/global/properties_details.php?saleLease=forSale&propertyLocationState=-1&ForSaleLooplinkSubmit=Search&StateSelect=1&lease=1&__utma=165464866.6399789.1238386077.1238386077.1238386077.1&__utmb=165464866&__utmc=165464866&__utmz=165464866.1238386077.1.1.utmccn%3D%28direct%29%7Cutmcsr%3D%28direct%29%7Cutmcmd%3D%28none%29&page=1&id=43385

    I’m not extremely PHP savvy but I’ve done enough tooling with shopping carts and CMS to know how to hack it up…but this one is surprisingly complicated! Any help is appreciated. :mrgreen:

    # April 8, 2009 at 3:04 pm

    Sorry My superhuman superpower of reading minds has left me for tonight as the superpower is in for its annual service.

    but send what to a friend?
    Who is the friend?

    that page you linked to is just a property for sale page…. I think

    if this is the page you want the send link to friend, then why dont you make a contact form with only a field for the persons email.

    then in the PHP get the referring page link then send that in the body of your email:

    example…. and only an example, not fully tested PHP friendcontact.php:

    Code:
    < ?php

    $EmailTo = $_REQUEST['email'];
    $Subject = "Property for Sale with LA";
    $email = "LA@LA.com"; //not the real email

    $refered_from = $_SERVER['HTTP_REFERER'];

    $Body = "";
    $Body = "Here is a property that is for sale with LA:";
    $Body .= "n";
    $Body .= "n";
    $Body .= "A friend of yours thought you might want to look at it, so please click the link below to view the property";
    $Body .= "n";
    $Body .= "$refered_from";

    $success = mail($EmailTo, $Subject, $Body, "From: <$email>“, “-fLA@LA.com”);
    ?>

    HTML something like this:

    Code:


       
    # April 8, 2009 at 8:24 pm

    So sorry, my brain was closer to a stack overflow than I thought when I posted this! ;)

    Basically, the client, who is a real estate agent (not this company but another, this is just the example he sent me) wants a link on each listing page that says "Send this page to a friend." When they click the link, it will bring them to a little form that they will end up filling out their name and the recipient’s e-mail and it will e-mail the page to the ‘friend.’ I assume to do this, I need to know the hosts’s formmail script since I assume it calls on similar functions to send the e-mail. Aside from knowing that, I’m not versed enough to really be able to code this myself.

    Is this a better explanation or is my brain as fried as it feels today?

    # April 9, 2009 at 2:36 am
    "Luminated" wrote:
    So sorry, my brain was closer to a stack overflow than I thought when I posted this! ;)

    Basically, the client, who is a real estate agent (not this company but another, this is just the example he sent me) wants a link on each listing page that says "Send this page to a friend." When they click the link, it will bring them to a little form that they will end up filling out their name and the recipient’s e-mail and it will e-mail the page to the ‘friend.’ I assume to do this, I need to know the hosts’s formmail script since I assume it calls on similar functions to send the e-mail. Aside from knowing that, I’m not versed enough to really be able to code this myself.

    Is this a better explanation or is my brain as fried as it feels today?

    make the form as you want it to look.

    I would have the form on the page, and send from there.

    mail($EmailTo, $Subject, $Body, "From: <$email>", "-fLA@LA.com");
    is the mail function, this really is all you need, however, I have never got it to work without the -f you need this for your root email that its working from.

    the rest of the script is getting the values of the contact form, populating the body of the email, etc.

    what I gave you was basic, but you could add in other stuff like if it was successful, send the real estate agent an email also, so that they could follow up a lead

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".