Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-12-2007, 10:24 PM   PM User | #1
UD2006
Regular Coder

 
Join Date: Jul 2007
Location: Velsen Noord, Netherlands
Posts: 206
Thanks: 6
Thanked 0 Times in 0 Posts
UD2006 is an unknown quantity at this point
Shoppingcart checkout file error

I've created a website with a shoppingsystem, everything works great, but the problem comes to sending the order away. I've made a test order but my client receives an empty email (PHPemail) without order, address info.

Can somebody help me (going on vacation 16 july, but would like to finish the website before that).

Here are the code for the last checkout page and for the PHPemail (process.php)

<script language="JavaScript" type="text/javascript">
<!--
var NewEoc2 = document.cookie;
var ShipTotal=0;
var Total=0;
var SaleTotal=0;
var X1 ="";
var X2 =0;
var X3 =0;
var X4 =0;
var today = new Date();
var expiry = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000);
var Xname = new Array();
var sdesc = new Array();
var cost = new Array();
var ship = new Array();
var quant = new Array();
var urls = new Array();
var comments = new Array();
var f = document.form;
var value;
var found = 0; var whattowritepp = "";
var CookieAll;
var TotalQuant=0;
var TotalProducts=0;
var SubTotals;
var DiscountAmt= 0;


var UsingPayPal = 0;
function getallCookie() {
//new spanning code
var whole_cookie = document.cookie;
var each_cookie = whole_cookie.split(";") ;
var value ="";

var index;

for (var i=0; i< each_cookie.length;i++){
index = each_cookie[i].indexOf("NewEoc2=");
if( index != -1) {
index = each_cookie[i].split("=");
value += unescape(index[1]);

}
}

for(var j=0; j<each_cookie.length;j++){
index = each_cookie[j].indexOf("NewEoc2"+j+"=");
if( index != -1) {
index = each_cookie[j].split("=");
value += unescape(index[1]);
}
}

return unescape(value);
}

function OpenIn(NewLocation) {document.location = NewLocation;return false;}

function round(number) { number = Math.round(number*Math.pow(10,2))/Math.pow(10,2);
return (number == Math.floor(number)) ? number + '.00' : ( (number*10 == Math.floor(number*10)) ? number + '0' : number); }



function SAB() { f = document.form77; f.Name.value = f.BName.value; f.Street.value = f.BStreet.value; f.City.value = f.BCity.value; f.Zip.value = f.BZip.value; f.Country.value = f.BCountry.value; f.Phone.value = f.BPhone.value; f.Fax.value = f.BFax.value;return true;}
function VerifySubmit() {
if (document.form77.BName.value == "") {
alert("Vul AUB uw Name");return false;}if (document.form77.BEmail.value == "") {
alert("Vul AUB uw email");return false;}if (document.form77.BPhone.value == "") {
alert("Vul AUB uw Phone");return false;}if (document.form77.BStreet.value == "") {
alert("Vul AUB uw Street");return false;}if (document.form77.BCity.value == "") {
alert("Vul AUB uw City");return false;}if (document.form77.BZip.value == "") {
alert("Vul AUB uw Zip");return false;}if (document.form77.BCountry.value == "") {
alert("Vul AUB uw Country");return false;} EmptyCart(); return true;}


function EmptyCart() {
var value="";
var expiry = new Date(today.getTime()-10 );
document.cookie= "NewEoc2=value; expires=" + expiry.toGMTString()+";path=/;";
NewEoc2 = document.cookie;
return true;}



function GetFromCart() {
CookieAll = getallCookie();
ShipTotal = 0 ;
if (CookieAll == null) {
} else {
var EachCookie = CookieAll.split("^~^");
ShipTotal = EachCookie[0] || 0;
ShipTotal = ShipTotal * 1;
X1 = EachCookie[1] || "" ;
X2 = EachCookie[2] || 0 ;
X2 = X2 * 1;
X3 = EachCookie[3] || 0 ;
X3 = X3 * 1;
X4 = EachCookie[4] || 0 ;
X4 = X4 * 1;
var j=0;
for (var i = 5; i < EachCookie.length; i=i+5){
Xname[j] = EachCookie[i] || 0;
sdesc[j] = EachCookie[i+1] || 0;
cost[j] = EachCookie[i+2] || 0;
ship[j] = EachCookie[i+3] || 0;
quant[j] = EachCookie[i+4] || 0;
j++;}}

var whattowrite = "";
whattowritepp = "";
var k = 1;
TotalQuant = 0;
for (i = 0; i < Xname.length; i++) {
if (quant[i] >0){
indTotal = cost[i]*quant[i];
TotalQuant += quant[i]*1;
Total += indTotal;
whattowrite += "<tr class=\"COproductLine\">";
whattowrite += "<td class=\"COproductName\">" + sdesc[i]
whattowrite += "<input name=\"d["+ i
whattowrite +="]\" type=hidden value=\'"+sdesc[i]+"\'>";
whattowrite += "<input name=\"n["+ i
whattowrite +="]\" type=hidden value=\'"+Xname[i]+"\'></td>";
whattowrite += "<td align = center>&euro;" + cost[i]
whattowrite += "<input name=\"c["+ i
whattowrite +="]\" type=hidden value=\""+cost[i]+"\"></td>";
whattowrite += "<td align=center >&euro;"+ round(indTotal)+ "</td></tr>"
whattowritepp += "<input type=\"hidden\" name=\"item_name_"+k+"\" value=\'"+sdesc[i]+"\'>"
whattowritepp += "<input type=\"hidden\" name=\"item_number_"+k+"\" value=\'"+Xname[i]+"\'>"
whattowritepp += "<input type=\"hidden\" name=\"amount_"+k+"\" value=\""+cost[i]+"\">"
whattowritepp += "<input type=\"hidden\" name=\"quantity_"+k+"\" value=\""+quant[i]+"\">"
k++;
}
}
i = i-1;
if (i<0){i=0;}
whattowrite += "<tr class=\"COSalesLine\">"
whattowrite += "<input name=\"orderedtotal\""
whattowrite +=" type=hidden value=\""+i+"\">";
if (Total > 0) { Total += X2; }
var SaleTotal = 0;
SaleTotal = SaleTotal * 1;
if (ShipTotal > 0 && Total > 0 ) { whattowrite += "<tr class=\"COShippingLine\"><td colspan=\"3\"> \&nbsp; </td>"
whattowrite += "<td>Shipping Total"
whattowrite += "<input name=\"shiptotal\""
whattowrite +=" type=hidden value=\""+round(ShipTotal)+"\"></td>";
whattowrite += "<td align=center >&euro;"+ round(ShipTotal)+ "</td></tr>"}
SubTotals = Total;
if (Total > 0) {Total += ShipTotal+ SaleTotal ;}
whattowrite += "<tr class=\"COTotalLine\" ><td colspan=\"1\"> \&nbsp; </td>"
whattowrite += "<td>Totaal:"
whattowrite += "<input name=\"total\""
whattowrite +=" type=hidden value=\""+round(Total)+"\"></td>";
whattowrite += "<td align=center >&euro;"+ round(Total)+ "</td></tr>"
document.write(whattowrite); }


//-->
</script>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<LINK href="LAJDefault.css" type="text/css" rel="stylesheet">
</head>
<body class="BodyHtml" bgcolor="#FFFFFF" text="#FFFFFF" background="ARTbackground_iframe_schilderijen2.jpg" link="#FFFFFF" vlink="#FFFFFF" Alink="#FFFFFF">

<div align="center">

<p>
<SCRIPT language="JavaScript" SRC="includes/above.js"></SCRIPT>
</p>
</div>
<br>

<form name="form77" id="form77" method="post" onSubmit="return VerifySubmit();" action="" >
<p align="center">Vul uw gegevens in en verzend de bestelling.<br>
<p align="left">* Zijn verplicht</p><table align="center" width="100%" border="1" class="COMainTable">
<tr>
<td width="25%"><b>Titel & Beschrijving</b></td><td align = center width="20%"><b>Prijs</b></td><td align = center width="12%"><b>Totale Prijs</b></td></tr>
<tr class="COTableBottomEmptyRow"><td colspan="5" ><script type="text/javascript"> GetFromCart();</script> <tr><td colspan="3">
<b>Gegevens</b> &nbsp;
</td></tr>
<tr>
<td>Naam *</td>
<td colspan="2">
<input type="text" name="BName" size="55"></td></tr>
<tr><td>Straat</td>
<td colspan="2">
<input type="text" name="BStreet" size="55"></td></tr>
<tr><td>Woonplaats</td>
<td><input type="text" name="BCity" size="35"></td>
<td >Postcode <input type="text" name="BZip" size="15"></td>
</tr>
<tr><td>Land</td>
<td colspan="2">
<input type="text" name="BCountry" size="30"></td></tr>
<tr>
<td>Telefoon *</td>
<td colspan="2"><input type="text" name="BPhone" size ="20" ></td></tr>
<tr>
<td>email *</td>
<td colspan="2">
<input type="text" name="BEmail" size="50" ></td></tr>
<tr> <td colspan="3">Vul hier AUB nog aanvullende informatie </td> </tr>
<tr> <td colspan="3"><p> <textarea name="theComments" Rows="5" Cols="90"></textarea></p></td></tr>
<tr class="COTableBottomRow">
<td colspan="1" align=left valign="top">
<a href="schilderijen_dieren.html" target="_parent"><img src="winkel verder.gif" border="1"></a></td>
<td colspan="2" align=right>&nbsp;&nbsp;&nbsp; <a href="process.php" onClick="if(VerifySubmit()){document.form77.submit();};" > <img src="verzenden.gif" alt="Verzenden" border="1" ></a>&nbsp;&nbsp;</td>
</tr>
</table>
</form>

<div align="center">

<p>
<SCRIPT language="JavaScript" SRC="includes/below.js"></SCRIPT>



<?php

$xn = $HTTP_POST_VARS['n'];

$xd = $HTTP_POST_VARS['d'];

$xc = $HTTP_POST_VARS['c'];

$xq = $HTTP_POST_VARS['q'];

$xf = $HTTP_POST_VARS['f'];

error_reporting(E_ALL ^ (E_NOTICE));

$my_body = "";

$MailFrom = "From:". $HTTP_POST_VARS['BEmail']."\n";

$my_body .= "****************************************************************\n";

$my_body .= "De order bevat het volgende \n";

$my_body .= "Besteld op".date("F j, Y, g:i a") ."\n";

$my_body .= "****************************************************************\n";

for ($i =0; $i< $HTTP_POST_VARS['orderedtotal'];$i++){ if ($xn[$i] != "" )$my_body23 .= "Product ".$xd[$i]." @ cost " .$xc[$i]. " with ".$xq[$i] . " ordered\n";}

$my_body .= strip_tags($my_body23);

$my_body .= "************************************\n";

$my_body .= "Totale Prijs:= " . $HTTP_POST_VARS['total'] . "\n";

$my_body .= "****************************************************************\n";

$my_body .= "****************************************************************\n";

$my_body .= "Aanvullende informatie= " . $HTTP_POST_VARS['theComments']. "\n";

$my_body .= "****************************************************************\n";

$my_body .= "Adres gegevens\n";

$my_body .= "****************************************************************\n";

$my_body .= "Naam= " . $HTTP_POST_VARS['BName'] . "\n";

$my_body .= "Straat= " . $HTTP_POST_VARS['BStreet'] . "\n";

$my_body .= "Woonplaats= " . $HTTP_POST_VARS['BCity'] . "\n";

$my_body .= "Postcode= " . $HTTP_POST_VARS['BZip'] . "\n";

$my_body .= "Land=" . $HTTP_POST_VARS['BCountry']. "\n";

$my_body .= "Telefoon= " . $HTTP_POST_VARS['BPhone'] . "\n";

$my_body .= "email= " . $HTTP_POST_VARS['BEmail'] . "\n";

$my_body .= "****************************************************************\n";

mail($HTTP_POST_VARS['BEmail'],"Uw bestelling op Art Creations","$my_body" . "Mocht u vragen hebben dan kunt u ons altijd emailen. ", "$MailFrom");

$my_body .= "****************************************************************\n";

$my_body .= "Mocht u vragen hebben dan kunt u ons altijd emailen. \n";

mail("info@artcreations.nl","Uw bestelling op Art Creations","$my_body", "$MailFrom" );

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">



<html>

<head>

<title>Insert title</title>

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"><meta http-equiv="refresh" content="4;URL=www.artcreations.nl">



</head>



<body class="BodyHtml" bgcolor="#FFFFFF" text="#FFFFFF" background="ARTbackground_iframe_schilderijen2.jpg" link="#FFFFFF" vlink="#FFFFFF" Alink="#FFFFFF">





<div align="center">



<p>

<SCRIPT language="JavaScript" SRC="includes/above.js"></SCRIPT>



</div>

<br>



<p align="center"><?php

$my_body1 = "";

$my_body1 .= "Besteld op ".date("F j, Y, g:i a") ."\n"."<br>"."<br>";

for ($i =0; $i< $HTTP_POST_VARS['orderedtotal'];$i++){if ($xn[$i] != "" )$my_body31 .= "Product ".$xn[$i] . " ".$xd[$i]." @ Prijs ". $xc[$i]. " with ".$xq[$i] . " ordered"."\n<br>";}

print $my_body1. str_replace( "\\\"", "\"",$my_body31);

?><br><br> Bedankt voor uw bestelling!<br>We zullen een bevestiging naar u toesturen.<br>
<div align="center">



<p>

<SCRIPT language="JavaScript" SRC="includes/below.js"></SCRIPT>
</p>
</div>

</body>

</html>
UD2006 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:35 PM.


Advertisement
Log in to turn off these ads.