PDA

View Full Version : produce this on an order detail form


dazzclub
10-09-2006, 07:07 PM
hi people,

I`m trying to build an e-commerce site, and need some help.

what i would like to achive is when a customer buys a product/products and goes through all the nesscessary stuff like filling in the address, payment method, etc.

in some way have all that data put on another file, like an order form so i can look at it and clearly know what they want.

would this be a simple case of echo or would it be storing this in database and having the order from pull all this data out and display it?

cheers

domedia
10-09-2006, 07:11 PM
If you want to store this data (or you already are) you can just make a page that would query all purchases. If you're not storing data on your server, you can have the server send you an email after user has checked out.

dazzclub
10-09-2006, 07:28 PM
cheers for a qucik reply, on second thoughts, i think i need to store the data as i can use it for any mishaps that may occur with customer orders.

customers always right and all that, eh

thanks again

davidj
10-10-2006, 07:44 AM
you need a database

not only can you store your data but also remember what was bought previously

you could advance this to a username and password for purchases rather than keying the address again

its the only way to go

dazzclub
10-14-2006, 06:11 PM
hi guys here is an up date, on whats happened so far.

ive created an database, so when users choose what they want, it shows up on the order detail.

Ive created a login section, like an admin, so i can see log in and see the orders like taht.

know, ive added a section on the website where users can pay by credit card. im still testing at the mo, so i`ll get ssl on it later. The trouble is their details ( card details ) dont appear on the order at all.

the original payment method was done through paypal so now i want to ammend it where i only deal with it.

the website im "still working on is ukplatedesign.com

you can go there and place an order and go through and then when you go to process the final part, a piece of code appears saying it not enough columns blah blah.

if you need any coding let me know, and i`ll post it for you.

cheers

davidj
10-16-2006, 07:27 AM
ok

post the code

dazzclub
10-17-2006, 01:37 PM
ok here goes,

Im going to post 3 files of code, so you can understand better and it saves me from any spelling grammers.

this code is from shippinginformation.php (the form itself is a php include)
-------------------------------------------------------------------------------------

<?
$cart="SELECT * FROM cart where memberid = '".session_id()."' ";
$rcart=mysql_query($cart) or die(mysql_error());
while($rocart=mysql_fetch_array($rcart))
{
$subtotal=$subtotal+$rocart['total'];
}
function counttotalamount()
{
$sqlcount = "SELECT * FROM cart where memberid = '".$_SESSION['session_userid']."' ";
if(!($resultcount=mysql_query($sqlcount)))
{
echo "1--".$sqlcount.mysql_error();
exit;
}



while($rowcount=mysql_fetch_array($resultcount))//main while
{
$sqlproductprice = "select * from product where productid = '".$rowcount['productid']."' ";
if(!($resultproductprice=mysql_query($sqlproductpr ice)))
{
echo "1--".$sqlproductprice.mysql_error();
exit;
}
$rowproductprice = mysql_fetch_array($resultproductprice);

for($i=0; $i<$rowcount['quantity']; $i++)
{
$total += $rowproductprice['price'];
}
}
return $total;
}


function countweight()
{
$sqlcount = "SELECT * FROM cart where memberid = '".$_SESSION['session_userid']."' ";
if(!($resultcount=mysql_query($sqlcount)))
{
echo "1--".$sqlcount.mysql_error();
exit;
}



while($rowcount=mysql_fetch_array($resultcount))//main while
{
$sqlproductprice = "select * from product where productid = '".$rowcount['productid']."' ";
if(!($resultproductprice=mysql_query($sqlproductpr ice)))
{
echo "1--".$sqlproductprice.mysql_error();
exit;
}
$rowproductprice = mysql_fetch_array($resultproductprice);

for($i=0; $i<$rowcount['quantity']; $i++)
{
$total += $rowproductprice['unitweight'];
}
}
return $total;
}


?>
<script language="JavaScript">

function FormSubmit(form1)
{

if(form1.rdoption[0].checked)
{
//form1.action="https://https://www.ukplatedesign.com/index.php?toOpen=process";
form1.action="index.php?toOpen=process";
form1.submit();
}
if(form1.rdoption[1].checked)
{
//form1.action="https://https://www.ukplatedesign.com/index.php?toOpen=creditcard";
form1.action="index.php?toOpen=creditcard";
form1.submit();
}
if(form1.rdoption[2].checked)
{
//form1.action="https://www.ukplatedesign.com/index.php?toOpen=submitcheque";
form1.action="index.php?toOpen=submitcheque";
form1.submit();
}
}

</script>
<script language="JavaScript">
function chktotal(subtotal)
{
if(frmpersonalinfo.chkregistered.checked)
{
subtotal=subtotal+2;
frmpersonalinfo.subtotal.value=subtotal;
}
else
{
subtotal=subtotal;
frmpersonalinfo.subtotal.value=subtotal;
}
return true;
}
function validate()
{

if(frmpersonalinfo.txtBillingFirstName.value == "")
{
alert("Please Enter First Name");
frmpersonalinfo.txtBillingFirstName.focus();
return false;
}


if(frmpersonalinfo.txtBillingLastName.value == "")
{
alert("Please Enter Last Name");
frmpersonalinfo.txtBillingLastName.focus();
return false;
}

if(frmpersonalinfo.txtBillingAddress1.value == "")
{
alert("Please Enter Street Address");
frmpersonalinfo.txtBillingAddress1.focus();
return false;
}
if(frmpersonalinfo.txtBillingCity.value == "")
{
alert("Please Enter City");
frmpersonalinfo.txtBillingCity.focus();
return false;
}
if(frmpersonalinfo.txtshippingstate.value == "")
{
alert("Please Enter County");
frmpersonalinfo.txtshippingstate.focus();
return false;
}
if(frmpersonalinfo.txtshippingcountry.value == "")
{
alert("Please Enter Country");
frmpersonalinfo.txtshippingcountry.focus();
return false;
}
if(frmpersonalinfo.txtBillingZip.value == "")
{
alert("Please Enter Zip Code");
frmpersonalinfo.txtBillingZip.focus();
return false;
}

return true;
}

</script>
<link href="common/design.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="style.css">
<link type="text/css" rel="stylesheet" href="common/design.css">

<style type="text/css">
<!--
body {
background-color: #D7D7D7;
}
-->
</style><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#D7D7D7" class="tabl" id="table7">
<form name="frmpersonalinfo" method="post" action="billinginformation.php?userid=<?=$userid?>" onSubmit="javascript: return validate()">



<tr>
<td valign="middle">

Total Amount: &pound; <?=$subtotal?></p><input type="hidden" name="subtotal" value="<?=$subtotal?>"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC" class="bodyfont">



<font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#666666">Shipping Information.</font></td>
</tr>

<tr>

<td colspan="2" valign="top" width="100%" class="text"><div align="center"><font size="1"></font>


</div>

<table width="100%" class="tabl" border="0" align="center" cellPadding="0" cellSpacing="0" id="table9">
<tr>
<td vAlign="top" class="text">First Name<font color="#FF0000">*</font></td>
<td vAlign="top" class="text">Last Name<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input name="txtBillingFirstname" class="text" id="txtBillingFirstName2" size="40" maxlength="40" >
</td>
<td class="text"> <input name="txtBillingLastName" class="text" id="txtBillingLastName" size="40" maxlength="40" ></td>
</tr>
<tr>
<td class="text">House Name or Number <font color="#FF0000">*</font></td>
<td class="text">Street Address <font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input name="txtBillinghouse" class="text" id="txtBillinghouse" size="40" maxlength="40" />
</td>
<td class="text"> <input name="txtBillingAddress1" class="text" id="txtBillingAddress12" size="40" maxlength="40" ></td>
</tr>
<tr>
<td class="text">City<font color="#FF0000">*</font></td>
<td class="text">County<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input name="txtBillingCity" class="text" id="txtBillingCity2" size="40" maxlength="40" >
</td>
<td class="text"> <input name="txtshippingstate" type="text" class="text" id="txtshippingstate2" size="40" maxlength="40" > </font> </td>
</tr>
<tr>
<td class="text">Postal Code<font color="#FF0000">*</font></td>
<td class="text">Country<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">

<font color="#FF0000"> </font> <font color="#FF0000">
</font>
<input name="txtBillingZip" class="text" id="txtBillingZip" size="40" maxlength="40">


</td>
<td class="text"> <font color="#FF0000">
<input name="txtshippingcountry" type="text" class="text" id="txtshippingcountry3" size="40" maxlength="40">
</font> </td>
</tr>
<tr height="30">
<td valign="middle" class="text">

<span class="ccRight"> </span></font>[/b]</td>
<td class="text"><span class="ccRight">

</span></td>
</tr>
<tr height="30">
<td valign="middle" class="text"></td>
<td class="text"><span class="ccRight">

</span></td>
</tr>
<tr height="30">
<td valign="middle" class="text"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="BC0808"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="BC0808"><span class="GreyTxt">
<input name="chkuseinfo" type="checkbox" id="chkuseinfo" value="checkbox" />
</span></font><span class="GreyTxt"><font face="VERDANA,ARIAL,HELVETIA" color="firebrick" size="1">Use
this as my billing information</font></span><span class="GreyTxt"> </span></font></td>
<td class="text"><input type="checkbox" name="chkregistered" value="chk" onclick="javascript: chktotal(<?=$subtotal?>);" />
<font face="VERDANA,ARIAL,HELVETIA" color="firebrick" size="1"> Registered
Delivery + &amp;pound2</font></td>
</tr>
<tr>
<td align="left" vAlign="top" class="body">

<input type="submit" value="Next" class="inputbox"></td>
</tr>
</table>

</td>
</tr>
</form>

</table>


-------------------------------------
the next page is the billing page which also contains the credit card form
----------------------------------------------------------------------------------


<?
$cart="SELECT * FROM cart where memberid = '".session_id()."' ";
$rcart=mysql_query($cart) or die(mysql_error());
while($rocart=mysql_fetch_array($rcart))
{
//$subtotal=$subtotal+$rocart['total'];
}
function counttotalamount()
{
$sqlcount = "SELECT * FROM cart where memberid = '".$_SESSION['session_userid']."' ";
if(!($resultcount=mysql_query($sqlcount)))
{
echo "1--".$sqlcount.mysql_error();
exit;
}



while($rowcount=mysql_fetch_array($resultcount))//main while
{
$sqlproductprice = "select * from product where productid = '".$rowcount['productid']."' ";
if(!($resultproductprice=mysql_query($sqlproductpr ice)))
{
echo "1--".$sqlproductprice.mysql_error();
exit;
}
$rowproductprice = mysql_fetch_array($resultproductprice);

for($i=0; $i<$rowcount['quantity']; $i++)
{
$total += $rowproductprice['price'];
}
}
return $total;
}


function countweight()
{
$sqlcount = "SELECT * FROM cart where memberid = '".$_SESSION['session_userid']."' ";
if(!($resultcount=mysql_query($sqlcount)))
{
echo "1--".$sqlcount.mysql_error();
exit;
}



while($rowcount=mysql_fetch_array($resultcount))//main while
{
$sqlproductprice = "select * from product where productid = '".$rowcount['productid']."' ";
if(!($resultproductprice=mysql_query($sqlproductpr ice)))
{
echo "1--".$sqlproductprice.mysql_error();
exit;
}
$rowproductprice = mysql_fetch_array($resultproductprice);

for($i=0; $i<$rowcount['quantity']; $i++)
{
$total += $rowproductprice['unitweight'];
}
}
return $total;
}


?>
<script language="JavaScript">
var curdt =new Date();


var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s)
{
var i;
for (i = 0; i < s.length; i++){
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}

function stripCharsInBag(s, bag)
{
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function daysInFebruary (year)
{
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n)
{
for (var i = 1; i <= n; i++)
{
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
}
return this
}

function isDate(dtStr)
{
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if (pos1==-1 || pos2==-1)
{
alert("The date format should be : mm/dd/yyyy")
return false
}



if (strMonth.length<1 || month<1 || month>12)
{

alert("Please enter a valid month")
return false
}
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
{
alert("Please enter a valid day")
return false
}
if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
{
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
}
if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false)
{
alert("Please enter a valid date")
return false
}

return true
}

function onlyNumerics()

{
code = event.keyCode
if((code >=48) && (code <=57)) //0 - 48 and 9 - 57
event.returnValue = true
else if (code==47)
event.returnValue = true
else
event.returnValue = false

}

function emailcheck(str)
{
var at="@";
var dot=".";
var lat=str.lastIndexOf(at);
var lstr=str.length;
var ldot=str.lastIndexOf(dot);

if(str.indexOf(at)==-1)
{
return false;
}

if(str.lastIndexOf(at)==-1 || str.lastIndexOf(at)==0 || str.lastIndexOf(at)==(lstr-1))
{
return false;
}

if(str.lastIndexOf(dot)==-1 || str.lastIndexOf(dot)==0 || str.lastIndexOf(dot)==(lstr-1))
{
return false;
}

if(lat>ldot)
{
return false;
}

if(ldot-lat<2)
{
return false;
}

if(str.indexOf(" ")!=-1)
{
return false;
}
return true;
}

function validate()
{
x=document.frmcreditcard;
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;


function isInteger(s)
{
var i;
for (i = 0; i < s.length; i++)
{
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}

function stripCharsInBag(s, bag)
{ var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function checkInternationalPhone(strPhone)
{
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

if(x.credittype.value == "")
{
alert("Please Enter Credit Type");
x.credittype.focus();
return false;
}
if(x.creditnumber.value == "")
{
alert("Please Enter Credit Number");
x.creditnumber.focus();
return false;
}
if(x.securecode.value == "")
{
alert("Please Enter Secure Code");
x.securecode.focus();
return false;
}

if(x.lstissuemonth.value == "")
{
alert("Please select month of Issue ");
x.lstissuemonth.focus();
return false;
}

if(x.lstissueyear.value == "")
{
alert("Please select year of Issue");
x.lstissueyear.focus();
return false;
}

if(x.lstmonths.value == "")
{
alert("Please select month of expiration ");
x.lstmonths.focus();
return false;
}

if(x.lstyear.value == "")
{
alert("Please select year of expiration ");
x.lstyear.focus();
return false;
}

return true;

}
</script>

<script language="JavaScript">

function FormSubmit(form1)
{

if(form1.rdoption[0].checked)
{
//form1.action="https://www.ukplatedesign.com/sum.php";
form1.action="paypalprocess.php";
form1.submit();
}
if(form1.rdoption[1].checked)
{
//form1.action="https://www.ukplatedesign.com/creditcardprocess.php";
form1.action="creditcardprocess.php";
form1.submit();
}
if(form1.rdoption[2].checked)
{
//form1.action="https://www.ukplatedesign.com/chequeprocess.php";
form1.action="chequeprocess.php";
form1.submit();
}

}

</script>
<style>
#bttmnav{
height:68px;
width:780px;
float:left;
background-image: url(../images/bottom_img.gif);
background-repeat: no-repeat;

}
#boxC{
height:12px;
width:250px;
margin-left:528px;
margin-top:50px;
}
A:link {text-decoration: none; color: black;}
A:visited {text-decoration: none; color: black;}
A:active {text-decoration: none; color: black;}
A:hover {text-decoration: underline; color: black;}
</style>
<link type="text/css" rel="stylesheet" href="common/design.css">
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tabl" id="table7">
<tr>
<td class="bodyfont" bgcolor="#CCCCCC"><p style="margin-left: 20px;">

<font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#666666">Billing Information.</font></td>
</tr>
<tr>

<td width="100%" colspan="2" valign="top" bgcolor="#FFFFFF" class="text"><div align="center"><font size="1"></font>


</div>

<table width="87%" class="tabl" border="0" align="center" cellPadding="2" cellSpacing="0" id="table9">
<form name="frmbillinginformation" method="post" action="paypalprocess.php" enctype="multipart/form-data">
<input type="hidden" name="txtBillingFirstName" value="<?=$txtBillingFirstName?>">
<input type="hidden" name="txtBillingLastName" value="<?=$txtBillingLastName?>">
<input type="hidden" name="txtBillinghouse" value="<?=$txtBillinghouse?>">
<input type="hidden" name="txtBillingAddress1" value="<?=$txtBillingAddress1?>">
<input type="hidden" name="txtBillingCity" value="<?=$txtBillingCity?>">
<input type="hidden" name="txtshippingstate" value="<?=$txtshippingstate?>">
<input type="hidden" name="txtshippingcountry" value="<?=$txtshippingcountry?>">
<input type="hidden" name="txtBillingZip" value="<?=$txtBillingZip?>">
<input type="hidden" name="subtotal" value="<?=$subtotal?>">
<input type="hidden" name="userid" value="<?=$userid?>">
<input type="hidden" name="chkregistered" value="<?=$chkregistered?>">
<tr>
<td width="43%" vAlign="top" class="text">User id as email<font color="#FF0000">*</font></td>
<td vAlign="top" class="text"></td>
</tr>
<tr>
<td vAlign="top" class="text">

<font color="#FF0000">
</font>
<input maxlength="30" name="txtLoginName" size="30" class="text" />
<font color="#FF0000"> </font></td>
<td colspan="2" width="57%" vAlign="top" class="text"><font size="1"> IMPORTANT!
This is your Billing Identity.</font></td>
</tr>
<tr>
<td class="text">Maling email address
<font color="#FF0000">*</font></td>
<td class="text">Confirm maling email address<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input class="text" maxLength="60" name="txtEmail" size="30">
</p></td>
<td class="text"> <input class="text" maxLength="60" name="txtConfirmEmail" size="30"></td>
</tr>
<tr>
<td class="text">First Name<font color="#FF0000">*</font></td>
<td class="text">Last Name<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input class="text" maxLength="30" name="txtFirstName" size="30" value="<? if($chkuseinfo != "") {echo $txtBillingFirstName;} else {echo ""; } ?>">
</td>
<td class="bodyfont"> <input class="text" maxLength="30" name="txtLastName" size="30" value="<? if($chkuseinfo != "") {echo $txtBillingLastName;} else {echo ""; } ?>"></td>
</tr>
<tr>
<td class="text">House Name or Number
<font color="#FF0000">*</font></td>
<td class="text">Street Address <font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input class="text" maxlength="50" name="txthouse" size="30" value="<? if($chkuseinfo != "") {echo $txtBillinghouse;} else {echo ""; } ?>">
</td>
<td class="text"> <input class="text" maxlength="50" name="txtAddress1" size="30" value="<? if($chkuseinfo != "") {echo $txtBillingAddress1;} else {echo ""; } ?>"></td>
</tr>
<tr>
<td class="text">City<font color="#FF0000">*</font></td>
<td class="text">County<font color="#FF0000">*</font></td>
</tr>
<tr>
<td class="text">


<input class="text" maxlength="30" name="txtCity" size="30" value="<? if($chkuseinfo != "") {echo $txtBillingCity;} else {echo ""; } ?>">
</td>
<td class="text"> <input type="text" name="txtbillingstate" class="text" value="<? if($chkuseinfo != "") {echo $txtshippingstate;} else {echo ""; } ?>"></td>
</tr>
<tr>
<td class="text">Postal code<font color="#FF0000">*</font></td>
<td rowspan="6" class="text">Comments
<textarea class="text" name="comment" id="comment"></textarea> </td>
</tr>
<tr>
<td class="text">


<input class="text" maxlength="8" name="txtZip" size="30" value="<? if($chkuseinfo != "") {echo $textBillingZip;} else {echo ""; } ?>">
</td>
</tr>
<tr>
<td vAlign="top" class="text">Country<font color="#FF0000">*
</font></td>
</tr>
<tr>
<td vAlign="top" class="text">


<input type="text" name="txtbillingcountry" class="text" value="<? if($chkuseinfo != "") {echo $txtshippingcountry;} else {echo ""; } ?>">
</p></td>
</tr>
<tr>
<td colspan="3" vAlign="top" class="text">Phone Number(e.g. 123-456-7890)<font color="#FF0000">*
</font></td>
</tr>
<tr>
<td vAlign="top" class="text">

<font color="#FF0000"><font color="#FF0000">
<input class="text" maxlength="30" name="txtPhone" size="30">
</font></font></td>
</tr>
<tr>
<td colspan="2" vAlign="top" bgcolor="#FFFFFF" class="text"><table width="100%" border="0" cellpadding="5">
<input type="hidden" name="txtLoginName2" value="">
<input type="hidden" name="txtEmail2" value="">
<input type="hidden" name="txtFirstName2" value="">
<input type="hidden" name="txtLastName2" value="">
<input type="hidden" name="txthouse2" value="">
<input type="hidden" name="txtAddress12" value="">
<input type="hidden" name="txtCity2" value="">
<input type="hidden" name="txtbillingstate2" value="">
<input type="hidden" name="txtZip2" value="">
<input type="hidden" name="txtPhone2" value="">
<input type="hidden" name="txtbillingcountry2" value="">
<input type="hidden" name="comment2" value="">
<input type="hidden" name="subtotal2" value="18">
<input type="hidden" name="userid2" value="">
<input type="hidden" name="txtBillingFirstName2" value="hh">
<input type="hidden" name="txtBillingLastName2" value="hh">
<input type="hidden" name="txtBillingAddress12" value="hh">
<input type="hidden" name="txtBillinghouse2" value="hh">
<input type="hidden" name="txtBillingCity2" value="hh">
<input type="hidden" name="txtshippingstate2" value="hh">
<input type="hidden" name="txtshippingcountry2" value="hh">
<input type="hidden" name="txtBillingPhone" value="">
<input type="hidden" name="txtBillingZip2" value="hh">
<input type="hidden" name="sid" value="a0afc17dbbe8383aaf5811689f90cfd1">
<input type="hidden" name="chkregistered2" value="">
<tr>
<td colspan="2"><span class="bodyfont"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="BC0808">Credit
Card Details.</font></span></td>
<td width="22%"></td>
<td width="27%"></td>
</tr>
<tr>
<td width="17%" class="text">Credit type</td>
<td width="34%"><span class="body">
<select name="txtcreditcardtype" class="inputbox" style='width: 130pt;'>
<option value="Switch">Switch</option>
<option value="Master Card">Master Card</option>
<option value="Visa">Visa</option>
<option value="Solo">Solo</option>
</select>
</span></td>
<td class="bodyfont"></td>
<td></td>
</tr>
<tr>
<td height="33" class="text">Issue Number</td>
<td><input name="txtissueno" type="text" id="txtissueno" maxlength="50" class="inputbox"></td>
<td class="bodyfont"></td>
<td></td>
</tr>
<tr>
<td class="text">Credit Number<font color="#FF0000">*</font></td>
<td><input name="txtcreditnumber" type="text" id="creditnumber" maxlength="50" class="inputbox"></td>
<td class="bodyfont"></td>
<td></td>
</tr>
<tr>
<td class="text">CCID<font color="#FF0000">*</font></td>
<td> <span class="body">
<input name="txtsecurecode" type="text" id="securecode" class="inputbox1" maxlength="4">
</span></td>
<td class="bodyfont"></td>
<td><span class="GreyTxt"> </span><span class="GreyTxt"> </span></td>
</tr>
<tr>
<td class="text">Issue Date From</td>
<td colspan="2"><select name="txtlstissuemonth" class="inputbox" style='width: 64pt;'>
<option value="" selected>Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">Augest</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">Decmeber</option>
</select>

<select name="txtlstissueyear" class="inputbox" style='width: 64pt;'>
<option value="" selected>Year</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="text">Expiration Date<font color="#FF0000">*</font></td>
<td colspan="2"> <select name="txtlstmonths" class="inputbox" style='width: 64pt;'>
<option value="" selected>Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">Augest</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">Decmeber</option>
</select>

<select name="txtlstyear" class="inputbox" style='width: 64pt;'>
<option value="" selected>Year</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
</select> </td>
<td></td>
</tr>
<tr>
<td><input name="Submit2" type="Submit" class="inputbox" value="Submit"></td>
<td colspan="2" align="center"> <div align="left">
<input name="Submit" type="Submit" class="inputbox" value="Reset">
</div></td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" vAlign="top" bgcolor="#FFFFFF" class="text"><p align="center" style="margin-left: 10px;">


</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<div id="bttmnav">
<div class="text" id="boxC">about us (about-us.php) | contact us (contact-us.php) |Terms & conditions (terms-and-conditions.php)</div>
</div></td>




---------------------------------------------------
the next bit of code is where all the info is placed into a database, to which the order detail form grabs all the info, like their name, product they ordered , credit card number etc.

the problem is at the moment, no credit card info is turinging up, ive looked at the database and ive used the correct fields but obviously somethings wrong which i can t figure out.

<?

include("../inc/openconn.php");


foreach($_GET as $getvar => $getval){ ${$getvar} = $getval; }
foreach($_POST as $postvar => $postval){ ${$postvar} = $postval; }


//$_SESSION['session_loginname'];
//$_SESSION['session_userid'];
//$_SESSION['session_usertype'];

// for our server
//$UrlNotJustBedding = "http://".$HTTP_SERVER_VARS['HTTP_HOST']."/elieb";

//for clients server
//$UrlNotJustBedding = "http://".$HTTP_SERVER_VARS['HTTP_HOST']."";
/*echo $sqlmember="update member set billingusername ='$txtLoginName',billingemail ='$txtEmail',
billingfirstname ='$txtFirstName', billinglastname='$txtLastName', billingaddress='$txtAddress1',
billingcity='$txtCity', billingstate='$cboStste', countryid='$cboCountry',
billingzip='$txtZip', billingphone='$txtPhone', billingcomments='$comment',
shippingfirstname='$txtBillingFirstName', shippinglastname='$txtBillingLastName',
shippingaddress='$txtBillingAddress1',shippingcity ='$txtBillingCity',
shippingstate='$lstBillingState',shippingzip='$txt BillingZip',
shippingphone='$txtBillingPhone',creditcardtype='$ credittype',
creditcardnumber='$creditnumber',creditcardsecurec ode='$securecode',
expiremonth= '$lstmonths',
expireyear='$lstyear'
where memberid = '".$_SESSION['session_userid']."'";*/

$sqlbs="select * from member";
$resbs=mysql_query($sqlbs);
$norows=mysql_num_rows($resbs);
$rowmem=mysql_fetch_array($resbs);
/*if($rowmem['memberid']==session_id())
{
$sqlmember="update member set billingusername ='$txtLoginName',billingemail ='$txtEmail',
billingfirstname ='$txtFirstName', billinglastname='$txtLastName', billinghouse='$txthouse', billingaddress='$txtAddress1',
billingcity='$txtCity', billingstate='$txtbillingstate', billingcountry='$txtbillingcountry',
billingzip='$txtZip', billingphone='$txtPhone', billingcomments='$comment',
shippingfirstname='$txtBillingFirstName', shippinglastname='$txtBillingLastName',shippinghou se='$txtBillinghouse',
shippingaddress='$txtBillingAddress1',shippingcity ='$txtBillingCity',
shippingstate='$txtstate',shippingcountry='$txtshi ppingcountry',shippingzip='$txtBillingZip'
where memberid = '".$_SESSION['session_userid']."'";
if(!($resultmember=mysql_query($sqlmember)))
{
echo "1--".$sqlmember.mysql_error();
exit;
}


}
else
{*/
$sqlmember="insert into member (memberid,billingusername,billingemail,billingfirs tname,billinglastname,billinghouse,billingaddress,
billingcity,billingstate,billingcountry,billingzip ,billingphone,billingcomments,shippingfirstname,sh ippinglastname,shippinghouse,
shippingaddress,shippingcity,shippingstate,shippin gcountry,shippingzip)
values('".session_id()."','$txtLoginName','$txtEmail','$txtFirstName','$tx tLastName','$txthouse','$txtAddress1','$txtCity',
'$txtbillingstate','$txtbillingcountry','$txtZip', '$txtPhone','$comment','$txtBillingFirstName','$tx tBillingLastName','$txtBillinghouse','$txtBillingA ddress1','$txtBillingCity',
'$txtshippingstate','$txtshippingcountry','$txtBil lingZip')";

if(!($resultmember=mysql_query($sqlmember)))
{
echo "1--".$sqlmember.mysql_error();
exit;
}
$mid=mysql_insert_id();
//}

$sqlodm="select * from ordermaster where memberid = '".session_id()."'";
$resodm=mysql_query($sqlodm) or die(mysql_error());
//$nor=mysql_num_rows($resodm);
$rowodm=mysql_fetch_array($resodm);
if($chkregistered=="")
{
$txtchk='No';
}
else
{
$txtchk='Yes';
}
//if($nor==0)
//{
$sqlordermaster = " insert into ordermaster (memberid,orderdate,subtotal,status,chkreg) values ('".session_id()."',NOW(),'$subtotal','Paypal Unpaid','$txtchk')";
$resultordermaster=mysql_query($sqlordermaster) or die(mysql_error());
//$rowordermaster = mysql_fetch_array($resultordermaster);
$orderdetailid=mysql_insert_id();
//}
//else
//{
//$orderdetailid=$rowodm['ordermasterid'];
//}

$sqluser="select * from usertrack where userid='$userid'";
$resuser=mysql_query($sqluser) or die("user".mysql_error());
$rowuser=mysql_fetch_array($resuser);
$comm=$subtotal * $rowuser['commissionrate']/100;
$sqlsale="insert into salestrack (memberid,userid,salesdate,salesamount,salescommis sion) values
('".session_id()."','$userid',NOW(),'$subtotal','$comm')";
$ressale=mysql_query($sqlsale) or die(mysql_error());

$sqlcartdetails = "select * from cart where memberid = '".session_id()."'";
$resultcartdetail=mysql_query($sqlcartdetails) or die(mysql_error());

while($rowcartdetail=mysql_fetch_array($resultcart detail))//main while
{
$sqlproductdetail = "INSERT INTO orderdetail (ordermasterid,productname,platesize,memberid,quan tity,price,total,shipdate) values
('$orderdetailid','".$rowcartdetail['productname']."','".$rowcartdetail['platesize']."','".session_id()."',
'".$rowcartdetail['quantity']."','".$rowcartdetail['price']."','".$rowcartdetail['total']."',NOW())" ;
$resultproductdetail=mysql_query($sqlproductdetail ) or die(mysql_error());

}

$sqlcart="Delete from cart where memberid = '".session_id()."'";
if(!($resultcart=mysql_query($sqlcart)))
{
echo "1--".$sqlcart.mysql_error();
exit;
}

$sqlot="update ordertemp set orderid='$orderdetailid',orderstatus='Yes' where memberid='".session_id()."' and orderstatus='No'";
$resot=mysql_query($sqlot) or die(mysql_error());

$sqlor="select * from ordermaster where ordermasterid='$orderdetailid'";
$resor=mysql_query($sqlor) or die(mysql_error());
$rowor=mysql_fetch_array($resor);


$to=$txtEmail.",";
$to="darren@area.co.uk";

/* subject */
$subject = "Ordered Detail";

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers .= "To:$txtFirstName<$txtEmail>\r\n";
$headers .= "From: UK Plate Design <info@ukplatedesign.com>\r\n";
$shipdate=$rowor['orderdate'];
$matter = "<html><head><title>Test</title></head><body><TABLE cellSpacing=0 cellPadding=0 width=100% border=0 id=table3 style=\"font-family: Verdana; font-size: 10pt; color: #666666\">
<tr>
<td>Dear ".$txtFirstName."</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Thank you for the Order.</td>
<td></td>
</tr>
<tr>
<td>Your Order details are.</td>
<td></td>
</tr>
<tr>
<td>Billing Detail</td>
<td></td>
</tr>
<tr>
<td>Email Id</td>
<td>".$txtEmail."</td>
</tr>
<tr>
<td>First Name:</td>
<td>".$txtFirstName."</td>
</tr>
<tr>
<td>Last Name:</td>
<td>".$txtLastName."</td>
</tr>
<tr>
<td>Order ID:</td>
<td>".$orderdetailid."</td>
</tr>
<tr>
<td>Order Date:</td>
<td>".$shipdate."</td>
</tr>
<tr>
<td>Total Amount:</td>
<td>".$subtotal."</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Thanks</td>
<td></td>
</tr>
</TABLE></body></html>";
mail($to, $subject, $matter, $headers);

/*
//============= Paypal Integration =======================//

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to ukplates system to validate
$header .= "";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.ukplatedesign.com', 80, $errno, $errstr, 30);

// assign posted variables to local variables

//$item_name = $_POST['item_name'];
$item_number = $_POST['orderdetailid'];
//$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['subtotal'];
//$payment_currency = $_POST['mc_currency'];
//$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['darren@area.co.uk'];
$payer_email = $_POST['txtEmail'];

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}

//========================== Integration End =============================//


*/

?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>UK Plate Design</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="css/seo.css">
<link rel="stylesheet" type="text/css" href="css/main.css">

<style type="text/css">
<!--
body {
background-image: url(../images/xxx.jpg);
background-color: #CCC;
margin-left: 50px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
#container{
background-color:#6699CC;
width: 780px;
}
#classic{
height:43px;
width:204px;
margin-left:35px;;
margin-top:15px;
position:relative;
position:absolute;
left:20px;
top:217px;
width:181px;
height:42px;
}
#standardplate{
height:43px;
width:204px;
margin-left:35px;;
margin-top:15px;
position:relative;
position:absolute;
left:21px;
top:97px;
width:181px;
height:42px;

}
#showplate{
height:43px;
width:204px;
margin-left:35px;;
margin-top:15px;
position:relative;
position:absolute;
left:20px;
top:157px;
width:181px;
height:42px;

}
#freedelivery{
height:43px;
width:204px;
margin-left:35px;;
margin-top:15px;
position:relative;
position:absolute;
left:51px;
top:295px;
width:780px;
height:74px;
}
.style1 {color: #000000}
-->
</style>
</head>
<body>
<div id="banner">

<h1>UK Plate Design (index.php)</h1>
<div id="classic">images/classic_plate_img.png (retro.php)</div>
<div id="standardplate">images/standard_plate_img.png (index.php)</div>
<div id="showplate">images/show_plate_imge.png (index.php)</div>


</div>
<table width="780" border="0" cellpadding="0" cellspacing="0" background="images/ukplatedesign_bg.jpg" bgcolor="c8d2e0">
<tr>
<td width="780" height="0" valign="top" id="maintext"></td>
</tr>
<tr>
<td id="regplate" width="780" height="170">
<?php include("pdesigner.php"); ?>


</td>
</tr>
</table>
</body>
</html>

when you have completed the form and press submit this line of code appears on my page.

1--insert into member (memberid,billingusername,billingemail,billingfirs tname,billinglastname,billinghouse,billingaddress, billingcity,billingstate,billingcountry,billingzip ,billingphone,billingcomments,shippingfirstname,sh ippinglastname,shippinghouse, shippingaddress,shippingcity,shippingstate,shippin gcountry,shippingzip,cardname,creditcardtype,credi tcardnumber,cardaddress,creditcardsecurecode,expir emonth,expireyear,issueno,issuemonth,issueyear) values('5b33e6b6885f52af7323247feffb0d32','','','' ,'','','','', '','','','','','','','','','', '','','','','','','','','','','')Column count doesn't match value count at row 1

domedia
10-24-2006, 06:05 PM
davidj, did you get the last post.