Views
From SCT Knowledge Base
<?php
//Mainly there is main PHP File, which hosts two forms
viz. paypal's form and shipping address form
//Defining paypal's variables ----*/
$someCondition= false;
$ourSucessPage="http:\\www.doamin.com\sucesspage";
$ourCancelPage="http:\\www.doamin.com\cancelpage";
/*---- Defining post variables ----*/
$strEmail=$_POST['txtEmail'];
$strFirstName=$_POST['txtFirstName'];
$strLastName=$_POST['txtLastName'];
$strBillAdd1=$_POST['txtBillAdds1'];
$strBillAdd2=$_POST['txtBillAdds2'];
$strBillCity=$_POST['txtBillCity'];
$strBillState=$_POST['txtBillState'];
$strBillZipcode=$_POST['txtBillZip'];
$strBillCountry=$_POST['txtBillCountry'];
/*---- Checking if submit button is posted,
if yes then start to insert\update data into audit table ----*/
if(isset($_POST['cmdContinue']) && ($_POST['cmdContinue']=="Continue"))
{
/*---- MySQL select query to check
if user is already exists in Audit User table-----*/
$qrySelectAuditUser= "Yuor select query here";
/*---- Execute MySQL select query to
check if user is already exists in Audit User table -----*/
$rsSelectAuditUser=mysql_query($qrySelectAuditUser);
/*---- Count number of rows-----*/
$numRowsSelectAuditUser=mysql_num_rows($rsSelectAuditUser);
/*---- Count of number of rows greater than one
means there is something in Audit User table then fire update query-----*/
if($numRowsSelectAuditUser)
{
/*---- MySQL select query to check
if user is already exists in Audit User table-----*/
$qryUpdateAuditUser="Your select query here";
/*---- Execute MySQL select query to check if user is already exists in Audit User table-----*/
$rsUpdateAuditUser=mysql_query($qryUpdateAuditUser);
$someCondition= true;
}
else
{
/*---- MySQL select query to check if user is already exists in Audit User table-----*/
$qryInsertAuditUser= "Your select query here";
/*---- Execute MySQL select query to check if user is already exists in Audit User table-----*/
$rsInsertAuditUser=mysql_query($qryInsertAuditUser);
$someCondition= true;
}
}
/*---- Defining paypal's variables ----*/
//Paypal form is a standard form,
which accepts some standard parameters from user
/*---- If $someCondition is true then execute this code i.e. submit PayPal form-----*/
if($someCondition== true)
{
?>
<form name="frmPayPal" id="frmPayPal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="upload" value="1"/>
<input type="hidden" name="business" value="light__1253596963_biz@yahoo.com"/>
<input type="hidden" name="cbt" value="Return to Mahayogi Gagangiri website"/>
<input type="hidden" name="paymentaction" value="sale"/>
<input type="hidden" name="return" value="<?php echo $ourSucessPage; ?>" />
<input type="hidden" name="cancel_return" value="<?php echo $ourCancelPage; ?>" />
<input type="hidden" name="address_override" value="1"/>
<input type="hidden" name="first_name" value="<?php echo $strFirstName; ?>"/>
<input type="hidden" name="last_name" value="<?php echo $strLastName; ?>"/>
<input type="hidden" name="address1" value="<?php echo $strBillAdd1;?>"/>
<input type="hidden" name="address2" value="<?php echo $strBillAdd2;?>"/>
<input type="hidden" name="city" value="<?php echo $strBillCity;?>"/>
<input type="hidden" name="state" value="<?php echo $strBillState;?>"/>
<input type="hidden" name="zip" value="<?php echo $strBillZipcode;?>"/>
<input type="hidden" name="country" value="<?php echo $strBillCountry;?>"/>
</form>
<?php
}
?>
<?php
/*-----
Customize shipping address form should made by programmer,
and it has no connection with paypal rather than passing some of Mandatory shipping addrees to
paypal's standard form, it's main duty is to accept general data
from user viz. his\her name,email,billing address,shipping address etc.
------*/
?>
<form id="frmBillShipForm" name="frmBillShipForm" action="" method="post">
<label for="txtFirstName">First Name:</label><input type="text" id="txtFirstName"
name="txtFirstName" size="30" maxlength="60" tabindex="1" title="Enter First Name" value="" />
<label for="txtLastName">Last Name:</label><input type="text" id="txtLastName"
name="txtLastName" size="30" maxlength="60" tabindex="2" title="Enter Last Name" value=""/>
<label for="txtLastName">Email:</label><input type="text" id="txtEmail"
name="txtEmail" size="30" maxlength="60" tabindex="2" title="Enter your email id" value=""/>
<label for="selGender">Gender:</label>
<select id="selGender" name="selGender" tabindex="3" title="Select Gender" >
<option>Select Gender</option>
<option value="Male" >Male</option>
<option value="Female">Female</option>
</select>
<label for="selGender">Date of Birth:</label>
<label for="txtBillAdds1">Address 1:</label><input type="text"
id="txtBillAdds1" name="txtBillAdds1" maxlength="150" tabindex="9"
title="Enter Address 1" value=""/>
<label for="txtBillAdds2">Address 2:</label><input type="text"
id="txtBillAdds2" name="txtBillAdds2" maxlength="150" tabindex="10" title="Enter Address 2" value=""/>
<label for="txtBillCity">City:</label><input type="text"
id="txtBillCity" name="txtBillCity" maxlength="150" tabindex="11" title="Enter City" value=""/>
<label for="txtBillState">State:</label><input type="text"
id="txtBillState" name="txtBillState" maxlength="150" tabindex="12" title="Enter State" value=""/>
<label for="txtBillZip">Zip Code:</label><input type="text"
id="txtBillZip" name="txtBillZip" maxlength="10" tabindex="13" title="Enter Zipcode" value=""/>
<label for="txtBillCountry">Country:</label>
<select id="txtBillCountry" class="textBox"
name="txtBillCountry" title="Select Country">
</select>
<label for="txtBillAdds1">Address 1:</label><input type="text"
id="txtShipAdds1" name="txtShipAdds1" maxlength="150" tabindex="9" title="Enter Address 1" value=""/>
<label for="txtBillAdds2">Address 2:</label><input type="text"
id="txtShipAdds2" name="txtShipAdds2" maxlength="150" tabindex="10" title="Enter Address 2" value=""/>
<label for="txtBillCity">City:</label><input type="text"
id="txtShipCity" name="txtShipCity" maxlength="150" tabindex="11" title="Enter City" value=""/>
<label for="txtBillState">State:</label><input type="text"
id="txtShipState" name="txtShipState" maxlength="150" tabindex="12" title="Enter State" value=""/>
<label for="txtBillZip">Zip Code:</label><input type="text"
id="txtShipZip" name="txtShipZip" maxlength="10" tabindex="13" title="Enter Zipcode" value=""/>
<label for="txtBillCountry">Country:</label>
<select id="txtShipCountry" class="textBox" name="txtShipCountry" title="Select Country">
</select>
<input id="cmdContinue" type="submit" value="Continue" title="Click to Payment" />
</form>
