PHP Script Help

I need some help with PHP. I am a webmaster. I have a page on my site that when “Continue” is clicked it calls the PHP which then calls up the other system. Before it can go through, people need to accept a Policy. They need to do this by a checkbox. If they don’t, it can’t go through.

The system now will go through if the checkbox is off or on. I included the PHP script below. Can you tell me where I need to enter the “if” statement to make this work? They told me to put this in somewhere but I have no idea about PHP coding. Thanks.

Chris

------------------------ I think this is the code that needs to be entered to make it work.

if(ssl_privacy_policy=null)
{
//curl script
}
else
{echo “You must accept the privacy policy to continue.”;
}

This is the code that I have now

<?php // Set variables $merchantID = ""; //Virtual Merchant Account ID $merchantUserID = ""; //Virtual Merchant User ID $merchantPinCode = ""; //Virtual Merchant PIN //$url = "https://www.myvirtualmerchant.com/VirtualMerchant/process.do"; // URL to the payment processor $url = "https://www.myvirtualmerchant.com/VirtualMerchant/process.do"; // URL to the payment processor $certPath = getcwd()."/vmsslca.crt"; //Specify your ssl certificate. // Read the following querystring variables $ssl_first_name = $_POST['ssl_first_name']; // Posting first name $ssl_last_name = $_POST['ssl_last_name']; // Posting last name $cvv2ind='1'; $ssl_email = $_POST['ssl_email']; // Posting email address $ssl_avs_address = $_POST['ssl_avs_address']; // Posting user address $ssl_city = $_POST['ssl_city']; // Post User City $ssl_state = $_POST['ssl_state']; // Post User State $ssl_avs_zip = $_POST['ssl_avs_zip']; // Post User ZIP $ssl_phone = $_POST['ssl_phone']; // Post user phone $ssl_card_number = $_POST['ssl_card_number']; // Post User CC $ssl_exp_date=$_POST['ssl_exp_date']; //Exp Date $ssl_stewardship_number=$_POST['ssl_stewardship_number']; //Post Stewardship Number $ssl_privacy_policy=$_POST['ssl_privacy_policy']; //Post Privacy Policy $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch,CURLOPT_POST, true); // set POST method // Set up the post fields. If you want to add custom fields, you would add them in Virtual Merchant, and add the field name in the curlopt_postfields string. curl_setopt($ch,CURLOPT_POSTFIELDS, "ssl_merchant_ID=$merchantID". "&ssl_user_id=$merchantUserID". "&ssl_pin=$merchantPinCode". "&ssl_transaction_type=ccsale". "&ssl_avs_address=$ssl_avs_address". "&ssl_phone=$ssl_phone". "&ssl_avs_zip=$ssl_avs_zip". "&ssl_city=$ssl_city". "&ssl_state=$ssl_state". "&ssl_email=$ssl_email". "&ssl_card_number=$ssl_card_number". "&ssl_exp_date=$ssl_exp_date". "&ssl_stewardship_number=$ssl_stewardship_number". "&ssl_privacy_policy=$ssl_privacy_policy". "&ssl_show_form=true". "&ssl_first_name=$ssl_first_name". "&ssl_last_name=$ssl_last_name". "&ssl_cvv2cvc2_indicator=1". "&ssl_test_mode=false" ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_CAINFO, $certPath); $result = curl_exec($ch); // run the whole process curl_close($ch); // Close cURL ?>

You must use comparative (==),

if(ssl_privacy_policy==null)

[php]
if(ssl_privacy_policy==null)
{

<?php // Set variables $merchantID = ""; //Virtual Merchant Account ID $merchantUserID = ""; //Virtual Merchant User ID $merchantPinCode = ""; //Virtual Merchant PIN //$url = "https://www.myvirtualmerchant.com/VirtualMerchant/process.do"; // URL to the payment processor $url = "https://www.myvirtualmerchant.com/VirtualMerchant/process.do"; // URL to the payment processor $certPath = getcwd()."/vmsslca.crt"; //Specify your ssl certificate. // Read the following querystring variables $ssl_first_name = $_POST['ssl_first_name']; // Posting first name $ssl_last_name = $_POST['ssl_last_name']; // Posting last name $cvv2ind='1'; $ssl_email = $_POST['ssl_email']; // Posting email address $ssl_avs_address = $_POST['ssl_avs_address']; // Posting user address $ssl_city = $_POST['ssl_city']; // Post User City $ssl_state = $_POST['ssl_state']; // Post User State $ssl_avs_zip = $_POST['ssl_avs_zip']; // Post User ZIP $ssl_phone = $_POST['ssl_phone']; // Post user phone $ssl_card_number = $_POST['ssl_card_number']; // Post User CC $ssl_exp_date=$_POST['ssl_exp_date']; //Exp Date $ssl_stewardship_number=$_POST['ssl_stewardship_number']; //Post Stewardship Number $ssl_privacy_policy=$_POST['ssl_privacy_policy']; //Post Privacy Policy $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch,CURLOPT_POST, true); // set POST method // Set up the post fields. If you want to add custom fields, you would add them in Virtual Merchant, and add the field name in the curlopt_postfields string. curl_setopt($ch,CURLOPT_POSTFIELDS, "ssl_merchant_ID=$merchantID". "&ssl_user_id=$merchantUserID". "&ssl_pin=$merchantPinCode". "&ssl_transaction_type=ccsale". "&ssl_avs_address=$ssl_avs_address". "&ssl_phone=$ssl_phone". "&ssl_avs_zip=$ssl_avs_zip". "&ssl_city=$ssl_city". "&ssl_state=$ssl_state". "&ssl_email=$ssl_email". "&ssl_card_number=$ssl_card_number". "&ssl_exp_date=$ssl_exp_date". "&ssl_stewardship_number=$ssl_stewardship_number". "&ssl_privacy_policy=$ssl_privacy_policy". "&ssl_show_form=true". "&ssl_first_name=$ssl_first_name". "&ssl_last_name=$ssl_last_name". "&ssl_cvv2cvc2_indicator=1". "&ssl_test_mode=false" ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_CAINFO, $certPath); $result = curl_exec($ch); // run the whole process curl_close($ch); // Close cURL ?> } else {echo "You must accept the privacy policy to continue."; }[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service