SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Mar 2004
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding variables automatically to include order data in newsletter list/script/db.

    Hi,

    I have a newsletter script that allows me to integrate it with my shopping cart, but it is not that easy...well not for me!

    I want to add the name and email from the orders, which use the variables: $ordName and $ordEmail in the shopping cart, to the php script provided by newsletter script coder, but can't figure out how.

    Here is the script, I should use for integration, provided by the newsletter script coder:

    Code:
    <?
    //RegisterProspect function will send all information to register.cgi
    //Here is exaple of using this fuction
    //RegisterProspect('useremail@hotmail.com','John Doe');
    function RegisterProspect($email,$name)
    {
    
        $ordEmail=urlencode($email);
        $ordName=urlencode($name);
        $URL="http://www.mysite.com/cgi-bin/newsletter/register.cgi";
        $account=5;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"$URL");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,
            "account=$account&email=$email&name=$name"
        );
        curl_exec ($ch);
        curl_close ($ch);
    }
    ?>

    I have made it work as a test by simply uncommenting the fourth line: "//RegisterProspect('useremail@hotmail.com','John Doe');" and the sample data was added to my newsletter list.

    However, I don't want to add "useremail@hotmail.com" and "John Doe" to my newsletter list since that was only a test with some samples. So, my questions are:

    • How can I grab the contents from the order itself knowing that the variables I am supposed to use are $ordName and $ordEmail ?
    • How could I transfer/add those order variables automatically to the function on the fourth line?


    Thanks in advance!

    SJ

  2. #2
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,337
    Mentioned
    192 Post(s)
    Tagged
    4 Thread(s)
    In a page where $ordName and $ordEmail are in scope, you would call:
    Code:
    RegisterProspect($ordEmail, $ordName);
    That is probably somewhere in the Shopping Cart code (on a page that is part of the Shopping Cart system)
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains


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
  •