I'm getting "Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /var/www/html/order2.php on line 180" Line 180 is "$15LtFridge = Trim(stripslashes($_REQUEST['PROD_15ltfridge_359']));" on the PHP page. Here are both pages of the form. Let me know if you can see the what the problem is.
Code PHP:<html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- function validateForm() { if(document.order.companyName.value == "") { alert("Please Enter The Value For company name "); return false; } if(document.order.ContactName.value == "") { alert("Please Enter The Value For contact name "); return false; } if(document.order.orderNumber.value == "") { alert("Please Enter The Value For order number "); return false; } if(document.order.phoneNumber.value == "") { alert("Please Enter The Value For phone number "); return false; } if(document.order.deliveryAddress.value == "") { alert("Please Enter The Value For delivery address "); return false; } return true; } /* This script is Copyright (c) Paul McFedries and Logophilia Limited ([url]http://www.mcfedries.com/)[/url]. Permission is granted to use this script as long as this Copyright notice remains in place.*/ function CalculateTotal(frm) { var order_total = 0 // Run through all the form fields for (var i=0; i < frm.elements.length; ++i) { // Get the current field form_field = frm.elements[i] // Get the field's name form_name = form_field.name // Is it a "product" field? if (form_name.substring(0,4) == "PROD") { // If so, extract the price from the name item_price = parseFloat(form_name.substring(form_name.lastIndexOf("_") + 1)) // Get the quantity item_quantity = parseInt(form_field.value) // Update the order total if (item_quantity >= 0) { order_total += item_quantity * item_price } } } // Display the total rounded to two decimal places frm.TOTAL.value = round_decimals(order_total, 2) } function round_decimals(original_number, decimals) { var result1 = original_number * Math.pow(10, decimals) var result2 = Math.round(result1) var result3 = result2 / Math.pow(10, decimals) return pad_with_zeros(result3, decimals) } function pad_with_zeros(rounded_value, decimal_places) { // Convert the number to a string var value_string = rounded_value.toString() // Locate the decimal point var decimal_location = value_string.indexOf(".") // Is there a decimal point? if (decimal_location == -1) { // If no, then all decimal places will be padded with 0s decimal_part_length = 0 // If decimal_places is greater than zero, tack on a decimal point value_string += decimal_places > 0 ? "." : "" } else { // If yes, then only the extra decimal places will be padded with 0s decimal_part_length = value_string.length - decimal_location - 1 } // Calculate the number of decimal places that need to be padded with 0s var pad_total = decimal_places - decimal_part_length if (pad_total > 0) { // Pad the string with 0s for (var counter = 1; counter <= pad_total; counter++) value_string += "0" } return value_string } <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <title>Order</title> </head> <body MARGINHEIGHT="0" TOPMARGIN="0" bgcolor="#000000" onLoad="MM_preloadImages('Images/contact1.jpg','Images/machines.jpg','Images/enquiries.jpg','Images/ourproducts.jpg','Images/ourservice.jpg','Images/coffeeorder.jpg','Images/home.jpg')"> <div align="center" height="100%"> <table width="981" border="0" cellspacing="0" id="layout" > <tbody> <tr> <td width="200" id="tl"> </td> <td id="tr"> <div align="right"><a href="http:///contact-us"> </a><a href="http:///contact-us"> </a><a href="Contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','Images/contact1.jpg',1)"><img src="Images/contact2.jpg" alt="Contact Us" name="Image11" width="80" height="13" border="0" id="Image11" /></a><a href="Machines.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image12','','Images/machines.jpg',1)"><img src="Images/machines2.jpg" alt="Machines" name="Image12" width="72" height="13" border="0" id="Image12" /></a><a href="Order.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','Images/coffeeorder.jpg',1)"><img src="Images/coffeeorder2.jpg" alt="Coffee Order" name="Image16" width="91" height="13" border="0" id="Image16" /></a><a href="Enqiries.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image13','','Images/enquiries.jpg',1)"><img src="Images/enquiries2.jpg" alt="Enquires" name="Image13" width="69" height="13" border="0" id="Image13" /></a><a href="Products.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','Images/ourproducts.jpg',1)"><img src="Images/ourproducts2.jpg" alt="Products" name="Image14" width="93" height="13" border="0" id="Image14" /></a><a href="OurService.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','Images/ourservice.jpg',1)"><img src="Images/ourservice2.jpg" alt="Our Service" name="Image15" width="83" height="13" border="0" id="Image15" /></a><a href="Index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','Images/home.jpg',1)"><img src="Images/home2.jpg" alt="Home" name="Image17" width="50" height="13" border="0" id="Image17" /></a></div></td> </tr> <tr> <td colspan="2" id="banner"><div id="headimg"><img src="Images/banner.jpg" width="981" height="126" /></div></td> </tr> <tr bgcolor="#000000"> <td colspan="2" id="tagline"><img src="Images/special.jpg" width="399" height="30" />v</td> </tr> <tr bgcolor="#000000"> <td id="sidebar"> <div align="center"><img src="Images/bean.jpg" width="200" height="300" align="baseline" /></div> <font color="#999999" size="-2" face="Arial">All content Copyright 2003<br/> LTD</font></td> <td bgcolor="#FFFFFF" id="content"> <div id="contentbox"> <div style=" width:778px; height:395px; overflow:auto;"> <table width="759" height="360" border="0" align="center" cellpadding="6" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <tr> <td height="356"><font color="#000000" face="Arial" size="2"><em><strong><br /> </strong></em></font> <blockquote style="margin-right: 0px;" dir="ltr"> <div align="center"><?php $mail_recipient = "emailaddress@emailaddress.co.nz"; $mail_subject = "Order"; $15LtFridge = Trim(stripslashes($_REQUEST['PROD_15ltfridge_359'])); $ProCooler = Trim(stripslashes($_REQUEST['PROD_procooler_499'])); $CompanyName = Trim(stripslashes($_REQUEST['companyName'])); $ContactName = Trim(stripslashes($_REQUEST['contactName'])); $OrderNumber = Trim(stripslashes($_REQUEST['orderNumber'])); $PhNumber = Trim(stripslashes($_REQUEST['phoneNumber'])); $DeliveryAddress = Trim(stripslashes($_REQUEST['deliveryAddress'])); $TOTAL = Trim(stripslashes($_REQUEST['TOTAL'])); $Body .= "15 Lt Fridge: ".$15LtFridge."\n"; $Body .= "Pro Cooler: ".$ProCooler."\n"; $Body .= "Company Name: ".$CompanyName."\n"; $Body .= "Contact Number: ".$ContactName."\n"; $Body .= "Order Number: ".$OrderNumber."\n"; $Body .= "Phone Number: ".$PhNumber."\n"; $Body .= "Delivery Address: ".$DeliveryAddress."\n"; $Body .= "Total Cost $: "$TOTAL."\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text; charset=iso-8859-1' . "\r\n"; // send email $success = mail($mail_recipient, $mail_subject, $Body, $headers); if($success==true) echo "Your mail has been Sent Successfully"; }else{ echo "Your mail has Not Sent Successfully"; } ?></div> <p></p> <p> </p> </blockquote> </td> </tr> </table> <div align="center"></div> </div> </div> </td> </tr> </tbody> </table> </div> </body></html>
Code HTML4Strict:<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- function validateForm() { if(document.order.companyName.value == "") { alert("Please Enter The Value For company name "); return false; } if(document.order.ContactName.value == "") { alert("Please Enter The Value For contact name "); return false; } if(document.order.orderNumber.value == "") { alert("Please Enter The Value For order number "); return false; } if(document.order.phoneNumber.value == "") { alert("Please Enter The Value For phone number "); return false; } if(document.order.deliveryAddress.value == "") { alert("Please Enter The Value For delivery address "); return false; } return true; } /* This script is Copyright (c) Paul McFedries and Logophilia Limited ([url]http://www.mcfedries.com/)[/url]. Permission is granted to use this script as long as this Copyright notice remains in place.*/ function CalculateTotal(frm) { var order_total = 0 // Run through all the form fields for (var i=0; i < frm.elements.length; ++i) { // Get the current field form_field = frm.elements[i] // Get the field's name form_name = form_field.name // Is it a "product" field? if (form_name.substring(0,4) == "PROD") { // If so, extract the price from the name item_price = parseFloat(form_name.substring(form_name.lastIndexOf("_") + 1)) // Get the quantity item_quantity = parseInt(form_field.value) // Update the order total if (item_quantity >= 0) { order_total += item_quantity * item_price } } } // Display the total rounded to two decimal places frm.TOTAL.value = round_decimals(order_total, 2) } function round_decimals(original_number, decimals) { var result1 = original_number * Math.pow(10, decimals) var result2 = Math.round(result1) var result3 = result2 / Math.pow(10, decimals) return pad_with_zeros(result3, decimals) } function pad_with_zeros(rounded_value, decimal_places) { // Convert the number to a string var value_string = rounded_value.toString() // Locate the decimal point var decimal_location = value_string.indexOf(".") // Is there a decimal point? if (decimal_location == -1) { // If no, then all decimal places will be padded with 0s decimal_part_length = 0 // If decimal_places is greater than zero, tack on a decimal point value_string += decimal_places > 0 ? "." : "" } else { // If yes, then only the extra decimal places will be padded with 0s decimal_part_length = value_string.length - decimal_location - 1 } // Calculate the number of decimal places that need to be padded with 0s var pad_total = decimal_places - decimal_part_length if (pad_total > 0) { // Pad the string with 0s for (var counter = 1; counter <= pad_total; counter++) value_string += "0" } return value_string } <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <title>Order Accessories</title> </head> <body MARGINHEIGHT="0" TOPMARGIN="0" bgcolor="#000000" onload="MM_preloadImages('Images/contact1.jpg','Images/machines.jpg','Images/enquiries.jpg','Images/ourproducts.jpg','Images/ourservice.jpg','Images/coffeeorder.jpg','Images/home.jpg')"> <div align="center" height="100%"> <table border="0" cellspacing="0" id="layout" > <tbody> <tr> <td width="200" id="tl"> </td> <td id="tr"> <div align="right"><a href=contact-us"> act-us"> </a><a href="Contact.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','Images/contact1.jpg',1)"><img src="Images/contact2.jpg" alt="Contact Us" name="Image11" width="80" height="13" border="0" id="Image11" /></a><a href="Machines.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image12','','Images/machines.jpg',1)"><img src="Images/machines2.jpg" alt="Machines" name="Image12" width="72" height="13" border="0" id="Image12" /></a><a href="Order.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','Images/coffeeorder.jpg',1)"><img src="Images/coffeeorder2.jpg" alt="Coffee Order" name="Image16" width="91" height="13" border="0" id="Image16" /></a><a href="Enqiries.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image13','','Images/enquiries.jpg',1)"><img src="Images/enquiries2.jpg" alt="Enquires" name="Image13" width="69" height="13" border="0" id="Image13" /></a><a href="Products.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image14','','Images/ourproducts.jpg',1)"><img src="Images/ourproducts2.jpg" alt="Products" name="Image14" width="93" height="13" border="0" id="Image14" /></a><a href="OurService.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image15','','Images/ourservice.jpg',1)"><img src="Images/ourservice2.jpg" alt="Our Service" name="Image15" width="83" height="13" border="0" id="Image15" /></a><a href="Index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','Images/home.jpg',1)"><img src="Images/home2.jpg" alt="Home" name="Image17" width="50" height="13" border="0" id="Image17" /></a></div></td> </tr> <tr> <td colspan="2" id="banner"><div id="headimg"><img src="Images/banner.jpg" width="981" height="126" /></div></td> </tr> <tr bgcolor="#000000"> <td colspan="2" id="tagline"><img src="Images/special.jpg" width="399" height="30" />v</td> </tr> <tr bgcolor="#000000"> <td id="sidebar"> <div align="center"><img src="Images/bean.jpg" width="200" height="300" align="baseline" /></div> <font color="#999999" size="-2" face="Arial">All content Copyright 2003<br/> ont></td> <td bgcolor="#FFFFFF" id="content"> <div id="contentbox"> <div style=" width:778px; height:395px; overflow:auto;"> <table width="759" height="342" border="0" align="center" cellpadding="6" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <tr> <td height="338"> <form action="order2.php" method="post" name="order" id="order" onsubmit="return validateForm()";> <table width="640" height="284" border="0" align="center"> <tr> <td width="763" height="280"><em><font size="1"> </font></em> <table width="634" border="0" align="center" cellpadding="1" cellspacing="0"> <tr bgcolor="#5B4E1C"> <td bgcolor="#663300" id="code"><div align="center"><font color="#FFFFFF" size="-1" face="Arial"><strong>CODE</strong></font></div></td> <td bgcolor="#663300" id="description"> <div align="center"><font color="#FFFFFF" size="-1" face="Arial"><strong>DESCRIPTION</strong></font></div></td> <td width="152" bgcolor="#663300" id="cups"><div align="center"><strong><font color="#FFFFFF" size="-1" face="Arial">IMAGE</font></strong></div></td> <td bgcolor="#663300" id="unitprice"><div align="center"><font color="#FFFFFF" size="-1" face="Arial"><strong>PRICE</strong></font></div></td> <td bgcolor="#653512" id="quantity"> <div class="noprint"> <div align="center"><font color="#FFFFFF" size="-1" face="Arial"><strong>QTY</strong></font></div> </div></td> </tr> <tr bgcolor="#CCFFFF"> <td width="130" bgcolor="#FFFFFF" class="code"><div align="center"><font color="#333333" size="-3" face="Arial">60192</font></div></td> <td width="229" bgcolor="#EFEFEF"> <div align="center"><font color="#333333" size="-2" face="Arial">15LT Fridge </font></div></td> <td bgcolor="#FFFFFF"> <div align="center"><img src="Images/15ltfridge.jpg" width="89" height="113" /></div></td> <td width="118" bgcolor="#EFEFEF"> <div align="center"><font size="-2" face="Arial">$359.00</font></div></td> <td width="70" bgcolor="#FFFFFF"> <div align="center"> <input name="PROD_15ltfridge_359" type="text" onchange="CalculateTotal(this.form)" id="PROD_15ltfridge_359" size="6"/> </div></td> </tr> <tr bgcolor="#CCFFFF"> <td bgcolor="#FFFFFF" class="code"><div align="center"><font color="#333333" size="-3" face="Arial">60190</font></div></td> <td bgcolor="#EFEFEF"> <div align="center"><font color="#333333" size="-2" face="Arial">Pro Cooler </font></div></td> <td bgcolor="#FFFFFF"><div align="center"><img src="Images/procooler.jpg" width="104" height="114" /></div></td> <td bgcolor="#EFEFEF"> <div align="center"><font size="-2" face="Arial">$499.00</font></div></td> <td bgcolor="#FFFFFF"> <div align="center"> <input name="PROD_procooler_499" type="text" id="PROD_procooler_499" onchange="CalculateTotal(this.form)" size="6" /> </div></td> </tr> <tr bgcolor="#FFFFFF"> <td height="38" colspan="5" class="code"> <div align="center"> <table width="707" border="0" cellspacing="10"> <tr> <td width="685" height="134"> <table width="569" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="31" colspan="4"><font color="#FF0000" face="Arial">All fields marked * are mandatory. </font><font color="#FF0000"> </font></td> </tr> <tr> <td width="133"><div align="right"><font face="Arial">Company Name<font color="#FF0000">*</font></font></div></td> <td width="165"> <div align="center"> <input type="text" name="companyName" id="companyName" value=""/> </div></td> <td width="114"><div align="right"><font face="Arial">Order Number<font color="#FF0000">*</font></font></div></td> <td width="157"> <div align="center"> <input type="text" name="orderNumber" id="orderNumber" value=""/> </div></td> </tr> <tr> <td><div align="right"><font face="Arial">Contact Name<font color="#FF0000">*</font></font></div></td> <td> <div align="center"> <input type="text" name="ContactName" id="ContactName" value=""/> </div></td> <td><div align="right"><font face="Arial">Phone Number<font color="#FF0000">*</font></font></div></td> <td> <div align="center"> <input type="text" name="phoneNumber" id="phoneNumber" value=""/> </div></td> </tr> <tr> <td height="24"><div align="right"><font face="Arial">Delivery Address<font color="#FF0000">*</font></font></div></td> <td> <div align="center"> <input type="text" name="deliveryAddress" id="deliveryAddress" value=""/> </div></td> <td> <div align="right"></div></td> <td> <div align="center"><font face="Arial">Total Cost </font> <input name="TOTAL" type="text" id="TOTAL" onfocus="this.form.elements[0].focus()" value="0.00" size="6" /> </div></td> </tr> <tr> <td height="38"> </td> <td> </td> <td> </td> <td><div align="center"> <input name="Submit" type="submit" value="Confirm Order"/> </div></td> </tr> <tr> <td height="38"><div align="right"></div></td> <td colspan="2"><div align="left"><img src="Media/adobe_pdf_logo.gif" width="49" height="47" border="0" /><a href="Media/APPLICATION%20FORM.pdf">Credit Application Form</a></div></td> <td> </td> </tr> </table></td> </tr> </table> </div></td> </tr> </table> <div align="right"> </div></td> </tr> </table> <div align="center"></div> </form> <font color="#333399" size="4"><em><strong><br /> </strong></em></font> </td> </tr> </table> <div align="center"></div> </div> </div> </td> </tr> </tbody> </table> </div> </body></html>





Bookmarks