Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Recommend a Friend

    Hi everybody,

    I am trying to build a free counter service for webmasters. My site is 75% finished - http://www.websitevrm.com (any feedback appreciated as would cool ideas for what i should i put on the home page). Anyway on the site I have made a recommend a friend form - http://www.websitevrm.com/recommend.php - but i cannot get it to work.

    I don't want to use a message box, I would like to set a default message instead. My usual 'contact us' forms have a thank you page that contains the php script processor. This is the script that powers my contact forms -

    <?
    $sitename=getenv("HTTP_HOST");
    $message.="Site: $sitename\n\n";
    while ( list( $key, $val )=each($HTTP_POST_VARS) )
    {
    $message .="$key : $val\n" ;
    }
    mail("info@yoursite.com","website enquiry",$message,"From: mail.yoursite.com");
    ?>

    The above script is great, you just place it in your thank you page and make your forms call it up. I am sure the above script can be modified to fit my email a friend form - but i cannot get it to work. any help would be greatly appreciated

    As for websiteVRM, i have found two backend kits to power it, but i seeing as your all webmasters i am still open to suggestions. I want to try and have the site finished sometime next week.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The thing is, your form is only mailing the thing to one person, you'll have to name the "X friend's name" and "X friend's email" boxes like this:

    <input ... name="names[]" />
    <input ... name="emails[]" />

    Then in your form (you'll need a new one){

    PHP Code:
    <? 
    $sitename
    =getenv("HTTP_HOST"); 
    $message "";
    for (
    $i=0;$i<count($names);$i++){
      
    $cur_name $names[$i];
      
    $cur_email $emails[$i];
      
    $message.="Site: $sitename\n\n";
      
    $message.="Dear $cur_name,\n\n" // Fill your message in the space below.
               
    ."So and so. Visit my site please.\n\n"
               
    ."Thanks, domain.com.";
      
    mail($cur_mail,"$senders_name would like to check this out",$message,"From: $senders_email");
      
    $message "";
    }
    ?>
    You get the idea, right?

    PS: Naming a group of fields "name[]" will tell the server to toss their values into an array, so you can get them all with name[$i] Very handy.
    Offtone.com - In the works...

  • #3
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I think i understand

    Will that script work for my recommend a friend form? as I can't test till I get home from work

    btw, could you show me an example of how i should name the form elements (boxes) i.e.

    your name - name form field box =
    your email address - name form field box =

    1st friends name - name form field box =
    1st friends email - name form field box =

    also on the third line of your script example is

    $message = "";

    what is that for as the other message variables i understand.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    because Syp}{ uses $message.='add this bit'; note the dot equals part - the variable $message is stored and just added to. Therefore once it got to sending email number two it would just add the mail string onto the end of email one. You could also just lose the dot from the first definer line
    $message = "Site: $sitename\n\n"; - without the dot it will just create the variable to that valuie rather than adding.

    form names - depends on the info you want sent - eg if you want a mail that reads...

    Dear zippy,

    Bungle was recently on our site and liked it enough to have this invitation sent out to you. Visit ourspace.com

    you'd need the senders name/ senders email and an array of recipient names and recipient emails

    <input type="text" name="senders_name">
    <input type="text" name="email">

    then repeat the two lines below as many times as you like.

    <input type="text" name="names[]">
    <input type="text" name="emails[]">

    one set of two for each poissible recipient.

    then.
    $message = 'Dear '.$names[$i].',

    '.$senders_name[$i].' was recently on our site and liked it enough to have this invitation sent out to you. Visit '.$sitename.'.';

    should work within the $i++ for loop.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #5
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy

    Hey guys, thanks for all your help. I stuck the code in a few days ago and i still get the same errors -


    Warning: Bad Message destination in D:\inetpub\websites\Casa\nThanks.php on line 27

    Warning: Bad Message destination in D:\inetpub\websites\Casa\nThanks.php on line 27

    Warning: Bad Message destination in D:\inetpub\websites\Casa\nThanks.php on line 27


    I have spent the last few nights trying everything to get the below code working.


    <?
    $sitename=getenv("HTTP_HOST");
    $message = "";
    for ($i=0;$i<count($names);$i++){
    $cur_name = $names[$i];
    $cur_email = $emails[$i];
    $message.="Look: $sitename\n\n";
    $message.="Dear $cur_name,\n\n" // Fill your message in the space below.
    ."So and so. Visit my site please.\n\n"
    ."Thanks, www.websitevrm.com";
    mail($cur_mail,"$senders_name check this out",$message,"From: $senders_email");
    $message = "test test test";
    }
    ?>


    My form fields are -

    senders name = field name - senders_name
    senders email = field name - senders_email

    friends name = field name - names[]
    friends email - field name - emails[]
    friends name = field name - names[]
    friends email - field name - emails[]
    friends name = field name - names[]
    friends email - field name - emails[]

    (I have 3 friend form fields, figured i should be precise and let you guys know)

    I am sure its something dumb i am dong wrong.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I'm finishing a refer-a-friend in php that will make all others pale in comparison. Look for it at the end of this month @ hotscripts/php. It rocks!
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #7
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thanks zoob, but I would kinda like to get my site up and running now. I could be missing out on millions of dollars of revenue. maybe.

    Can anyone tell me what i am doing wrong with the above script?

  • #8
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    right this is the error i am getting - http://www.websitevrm.com/sent.php

    and i am using this processor code in my thank you page

    <?
    $sitename=getenv("HTTP_HOST");
    $message = "";
    for ($i=0;$i<count($names);$i++){
    $cur_name = $names[$i];
    $cur_email = $emails[$i];
    $message.="Look: $sitename\n\n";
    $message.="Dear $cur_name,\n\n" // Fill your message in the space below.
    ."So and so. Visit my site please.\n\n"
    ."Thanks, www.websitevrm.com";
    mail($cur_mail,"$senders_name check this out",$message,"From: $senders_email"); <------- line 15
    $message = "";
    }
    ?>

  • #9
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Ok I have got it working and it sends the email, only i still get these errors on my webpage:

    Warning: Bad Message destination in D:\inetpub\websites\WebsiteVRM\sent.php on line 16

    Warning: Bad Message destination in D:\inetpub\websites\WebsiteVRM\sent.php on line 16

    Warning: Bad Message destination in D:\inetpub\websites\WebsiteVRM\sent.php on line 16

    Warning: Bad Message destination in D:\inetpub\websites\WebsiteVRM\sent.php on line 16

    This my code:

    <?
    $sitename=getenv("HTTP_HOST");
    $message = "";
    for ($i=0;$i<count($names);$i++){
    $cur_name = $names[$i];
    $cur_email = $emails[$i];
    $message.="Look: $sitename\n\n";
    $message.="Dear $cur_name,\n\n" // Fill your message in the space below.
    ."So and so. Visit this site please.\n\n"
    ."Thanks,\n\n
    .$senders_name";
    mail($cur_email,"Invitation from $senders_name",$message,"From: $senders_email"); - DAMN LINE 16
    }
    ?>

    I tried echoing the the mailing variables and it printed the friends name at the top of the thank you page.

  • #10
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your ite has a professional outlook, you ruin that with the porn joke. If anything, get rid of that.

  • #11
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    done. thanks for the compliment.

  • #12
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Originally posted by zoobie
    I'm finishing a refer-a-friend in php that will make all others pale in comparison. Look for it at the end of this month @ hotscripts/php. It rocks!
    zoob any news on that refer a friend script????

  • #13
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Anyone help??? puuuuuuuuuuuullllllleeeeeaaaasssssseeeeeeeee

  • #14
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    geesus zoob,

    i'm still waiting

    how much longer

  • #15
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just three more years. Hang in there

    Seriously though, your site's down now. You haven't found a refer-a-friend script yet? Or did you just dig this up for laughs?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •