Berikut adalah contoh scriptnya
<?php
if (!defined(‘WEB_ROOT’)
|| !isset($_GET['step']) || (int)$_GET['step'] != 1) {
exit;
}
$errorMessage = ‘ ’;
?>
<script language=”JavaScript” type=”text/javascript” src=”library/checkout.js”></script>
<table width=”550″ border=”0″ align=”center” cellpadding=”10″ cellspacing=”0″>
<tr>
<td>Step 1 Of 3 : Enter Shipping And Payment Information </td>
</tr>
</table>
<p id=”errorMessage”><?php echo $errorMessage; ?></p>
<form action=”<?php echo $_SERVER['PHP_SELF']; ?>?step=2″ method=”post” name=”frmCheckout” id=”frmCheckout” onSubmit=”return checkShippingAndPaymentInfo();”>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td colspan=”2″>Shipping Information</td>
</tr>
<tr>
<td width=”150″>First Name</td>
<td><input name=”txtShippingFirstName” type=”text” id=”txtShippingFirstName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Last Name</td>
<td><input name=”txtShippingLastName” type=”text” id=”txtShippingLastName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Address1</td>
<td><input name=”txtShippingAddress1″ type=”text” id=”txtShippingAddress1″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Address2</td>
<td><input name=”txtShippingAddress2″ type=”text” id=”txtShippingAddress2″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Phone Number</td>
<td><input name=”txtShippingPhone” type=”text” id=”txtShippingPhone” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Province / State</td>
<td><input name=”txtShippingState” type=”text” id=”txtShippingState” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>City</td>
<td><input name=”txtShippingCity” type=”text” id=”txtShippingCity” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Postal / Zip Code</td>
<td><input name=”txtShippingPostalCode” type=”text” id=”txtShippingPostalCode” size=”10″ maxlength=”10″></td>
</tr>
</table>
<p> </p>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td width=”150″>Payment Information</td>
<td><input type=”checkbox” name=”chkSame” id=”chkSame” value=”checkbox” onClick=”setPaymentInfo(this.checked);”>
<label for=”chkSame” style=”cursor:pointer”>Same as shipping information</label></td>
</tr>
<tr>
<td width=”150″>First Name</td>
<td><input name=”txtPaymentFirstName” type=”text” id=”txtPaymentFirstName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Last Name</td>
<td><input name=”txtPaymentLastName” type=”text” id=”txtPaymentLastName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Address1</td>
<td><input name=”txtPaymentAddress1″ type=”text” id=”txtPaymentAddress1″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Address2</td>
<td><input name=”txtPaymentAddress2″ type=”text” id=”txtPaymentAddress2″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Phone Number</td>
<td><input name=”txtPaymentPhone” type=”text” id=”txtPaymentPhone” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Province / State</td>
<td><input name=”txtPaymentState” type=”text” id=”txtPaymentState” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>City</td>
<td><input name=”txtPaymentCity” type=”text” id=”txtPaymentCity” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Postal / Zip Code</td>
<td><input name=”txtPaymentPostalCode” type=”text” id=”txtPaymentPostalCode” size=”10″ maxlength=”10″></td>
</tr>
</table>
<p> </p>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td width=”150″>Payment Method </td>
<td>
<input name=”optPayment” type=”radio” id=”optPaypal” value=”paypal” checked=”checked” />
<label for=”optPaypal” style=”cursor:pointer”>Paypal</label>
<input name=”optPayment” type=”radio” value=”cod” id=”optCod” />
<label for=”optCod” style=”cursor:pointer”>Cash on Delivery</label></td>
</tr>
</table>
<p> </p>
<p align=”center”>
<input name=”btnStep1″ type=”submit” id=”btnStep1″ value=”Proceed >>”>
</p>
</form>
<?php
if (!defined(‘WEB_ROOT’)
|| !isset($_GET['step']) || (int)$_GET['step'] != 1) {
exit;
}
$errorMessage = ‘ ’;
?>
<script language=”JavaScript” type=”text/javascript” src=”library/checkout.js”></script>
<table width=”550″ border=”0″ align=”center” cellpadding=”10″ cellspacing=”0″>
<tr>
<td>Step 1 Of 3 : Enter Shipping And Payment Information </td>
</tr>
</table>
<p id=”errorMessage”><?php echo $errorMessage; ?></p>
<form action=”<?php echo $_SERVER['PHP_SELF']; ?>?step=2″ method=”post” name=”frmCheckout” id=”frmCheckout” onSubmit=”return checkShippingAndPaymentInfo();”>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td colspan=”2″>Shipping Information</td>
</tr>
<tr>
<td width=”150″>First Name</td>
<td><input name=”txtShippingFirstName” type=”text” id=”txtShippingFirstName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Last Name</td>
<td><input name=”txtShippingLastName” type=”text” id=”txtShippingLastName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Address1</td>
<td><input name=”txtShippingAddress1″ type=”text” id=”txtShippingAddress1″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Address2</td>
<td><input name=”txtShippingAddress2″ type=”text” id=”txtShippingAddress2″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Phone Number</td>
<td><input name=”txtShippingPhone” type=”text” id=”txtShippingPhone” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Province / State</td>
<td><input name=”txtShippingState” type=”text” id=”txtShippingState” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>City</td>
<td><input name=”txtShippingCity” type=”text” id=”txtShippingCity” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Postal / Zip Code</td>
<td><input name=”txtShippingPostalCode” type=”text” id=”txtShippingPostalCode” size=”10″ maxlength=”10″></td>
</tr>
</table>
<p> </p>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td width=”150″>Payment Information</td>
<td><input type=”checkbox” name=”chkSame” id=”chkSame” value=”checkbox” onClick=”setPaymentInfo(this.checked);”>
<label for=”chkSame” style=”cursor:pointer”>Same as shipping information</label></td>
</tr>
<tr>
<td width=”150″>First Name</td>
<td><input name=”txtPaymentFirstName” type=”text” id=”txtPaymentFirstName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Last Name</td>
<td><input name=”txtPaymentLastName” type=”text” id=”txtPaymentLastName” size=”30″ maxlength=”50″></td>
</tr>
<tr>
<td width=”150″>Address1</td>
<td><input name=”txtPaymentAddress1″ type=”text” id=”txtPaymentAddress1″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Address2</td>
<td><input name=”txtPaymentAddress2″ type=”text” id=”txtPaymentAddress2″ size=”50″ maxlength=”100″></td>
</tr>
<tr>
<td width=”150″>Phone Number</td>
<td><input name=”txtPaymentPhone” type=”text” id=”txtPaymentPhone” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Province / State</td>
<td><input name=”txtPaymentState” type=”text” id=”txtPaymentState” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>City</td>
<td><input name=”txtPaymentCity” type=”text” id=”txtPaymentCity” size=”30″ maxlength=”32″></td>
</tr>
<tr>
<td width=”150″>Postal / Zip Code</td>
<td><input name=”txtPaymentPostalCode” type=”text” id=”txtPaymentPostalCode” size=”10″ maxlength=”10″></td>
</tr>
</table>
<p> </p>
<table width=”550″ border=”0″ align=”center” cellpadding=”5″ cellspacing=”1″>
<tr>
<td width=”150″>Payment Method </td>
<td>
<input name=”optPayment” type=”radio” id=”optPaypal” value=”paypal” checked=”checked” />
<label for=”optPaypal” style=”cursor:pointer”>Paypal</label>
<input name=”optPayment” type=”radio” value=”cod” id=”optCod” />
<label for=”optCod” style=”cursor:pointer”>Cash on Delivery</label></td>
</tr>
</table>
<p> </p>
<p align=”center”>
<input name=”btnStep1″ type=”submit” id=”btnStep1″ value=”Proceed >>”>
</p>
</form>
0 komentar:
Posting Komentar