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