fastoffice Posted May 6, 2008 Share Posted May 6, 2008 Hi Guys, Someone else built this page so I'm not sure on all its variables. I know I can ignore all the "include_once" calls and .js forms as they are form checkers for things we aren't using at the moment like multiple shipping addresses, discount codes & shipping costs. I know the solution is here in the code somewhere but with all the added junk in this cart form it's hard for me (a newbie) to decipher. Here's what I need. Its rather simple: I need the shopping cart to submit everything but then redirect to a thanks page or at minimum have a pop-up message say the order has been submitted with the empty cart page. What is does now is after the submit button is clicked it goes back to an empty shopping cart page like someone just cleared all the items out of the cart and hit "update cart". THAT'S SO NOT COOL. ----------- I tried a hidden form element to redirect after submit but that didn't work. I also tried this at the submit button> onClick="SubmitThanks()": function SubmitThanks() { var url = '../thanks.html'; top.location.href = url; } It redirected the page correctly after the form submit but didn't submit the form elements to my email. --------------------- If you want to see an example of what its doing go to: www.fastoffice.com, pick an item, fill out the cart form with any info and submit a test order. I have edited out all the non-essentials from the shopping cart page like the header and footer stuff leaving just the head code and the form. PLEASE HELP! I know its a simple solution and would be probably easier if I built the page but I came into this after it was all built so I'm a little perplexed. ------------------------------------------------- here's the code: <?PHP ob_start(); session_start(); ?> <?php include_once('../base.php'); ?> <?php include_once('../constants.php'); include_once('../sources/html.php'); $html = new Html(); include_once('../sources/gpc_filter.php'); $gpc = new GPCFilter(); ?> <HTML> <HEAD> <script language="JavaScript" src="../js/javascript.js"></script> <script language="JavaScript" src="../js/submitforquote.js"></script> <SCRIPT language="Javascript"> <?php /* * Modified by 2nd December include_once('../business/mod_shipment.php'); $shipment = new ModShipment(); $all_shipment_values = $shipment->getActiveShipmentValues(); $number_of_shipments = sizeof( $all_shipment_values ); echo "var shipment_names = new Array(".$number_of_shipments.");\n"; echo "var shipment_costs = new Array(".$number_of_shipments.");\n"; $counter = -1; foreach( $all_shipment_values as $name=>$value){ $counter++; echo "shipment_names[".$counter."]='".$name."';\n"; echo "shipment_costs[".$counter."]=".$value.";\n"; } */ ?> //modified @ 2nd December //by Abdul Samad function getShipmentCost( $key){ return shipment_costs[$key]; } function isInteger(str) { var a=0; while(a<str.length) { if( str.charAt(a)< '0' || str.charAt(a) > '9') return false; a++; } return true; } function UpdateDelivery() { //here update the delivery type and the shipment charges var delivery_id = MWJ_findObj('delivery_id'); var url = '../user/shoppingcart.php'; url = url+"?update_delivery=1"; document.location.href = url; } function EnableUpdate() { //window.alert('Enable'); var update = MWJ_findObj('updatebasket'); update.disabled = false; } function GetDiscount(){ //document.frmEditCart.action = '<?php echo $_SERVER['PHP_SELF'] ?>' var giftcode = MWJ_findObj('giftcode'); var discountcode = MWJ_findObj('discountcode'); if( trim(discountcode.value) == ''){ alert('Enter Your Discount Code Information'); return false; } else if(!isCharsInBag(discountcode.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789." )) { alert("Invalid Discount Code" ); return(false); } if(!isCharsInBag(giftcode.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789." )) { alert("Invalid Gift Code" ); return(false); } if ( CheckAllQuantity() == false){ //clik.disabled = true; return false ; } document.frmEditCart.submit(); } function GetGiftDiscount(){ //document.frmEditCart.action = '<?php echo $_SERVER['PHP_SELF'] ?>' var discountcode = MWJ_findObj('discountcode'); var giftcode = MWJ_findObj('giftcode'); if( trim(giftcode.value) == ''){ alert('Enter Your gift Code Information'); return false; } else if(!isCharsInBag(giftcode.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789." )) { alert("Invalid Gift Code" ); return(false); } if(!isCharsInBag(discountcode.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789." )) { alert("Invalid Discount Code" ); return(false); } if ( CheckAllQuantity() == false){ //clik.disabled = true; return false ; } document.frmEditCart.submit(); } function EmptyGiftDiscount(){ document.frmEditCart.giftcode.value=''; document.frmEditCart.emptyGiftDiscount.value='empty'; if ( CheckAllQuantity() == false){ //clik.disabled = true; return false ; } document.frmEditCart.submit(); } function emptyDiscountCode(){ document.frmEditCart.discountcode.value=''; document.frmEditCart.emptyDiscount.value='empty'; if ( CheckAllQuantity() == false){ //clik.disabled = true; return false ; } document.frmEditCart.submit(); } function EmptyBasket() { if(window.confirm('Are you sure you want to Empty Your Basket?')== false) return false; var url = '../user/shoppingcart.php?empty=1'; document.location.href = url; } function UpdateBasket() { var frm = document.forms['frmEditCart']; var clik = document.forms['frmEditCart'].updatebasket; var quote = document.forms['frmEditCart'].quote; if ( CheckAllQuantity() == false){ //clik.disabled = true; return; } quote.value = "update"; frm.submit(); } function CheckOut() { var payment_id = MWJ_findObj('payment_id'); if( payment_id.value == 0){ alert('Select Payment Type'); return false; } if(payment_id.value==1){ var url = 'checkout.php?payment_id=' + payment_id.value; }else{ var url = 'checkout.php?payment_id=' + payment_id.value; } <?php include_once('../business/mod_shipment.php'); $shipment = new ModShipment(); if( $shipment->isShipingEnabled() == true){ ?> var delivery_id = MWJ_findObj('delivery_id'); if( delivery_id.value == 0){ alert('Select Delivery Type'); return false; } url = url + '&delivery_id=' + delivery_id.value ; <?php } ?> top.location.href = url; } function ContinueShopping() { var url = '../index.html'; top.location.href = url; } function UpdateZipCode() { //here update the delivery type and the shipment charges var zipcode = MWJ_findObj('zipcode'); if( zipcode.value == ''){ alert('Enter Your ZipCode Information'); return false; } else if(zipcode.value.length != 5 || isInteger(zipcode.value) == false) { window.alert('Enter a valid Zip Code'); return; } var url = '../user/shoppingcart.php'; url = url+"?zipcode="+zipcode.value; document.location.href = url; } <?php include_once('../business/clsshopping.php'); $cart = new ShoppingCart; // user name for whole salers $rsqty = $cart->GetCartItems($HTTP_SESSION_VARS['sessionid'], $HTTP_SESSION_VARS['loginusername'], $_SESSION['affiliate_id']); //echo "fdgfd".$rsqty->fields['MinOrderQuantity']; ?> function CheckAllQuantity() { var qty = MWJ_findObj('Quantity[0]'); var count = 0; var quantity = 0; var pqty=0; var minqty = MWJ_findObj('MinQuantity[0]'); //pqty=minqty.value; while(qty != null){ quantity = qty.value; if(isInteger(quantity) == false || quantity == '' || quantity == 0){ window.alert('Please Enter a Valid Quantity'); qty.focus(); return false; } pqty=parseInt(minqty.value); //alert("Quantity "+ quantity +" Min Quantity "+ pqty); if(parseInt(quantity)<pqty) { window.alert('Quantity should be greater/equal than Minimum Order Quantity'); qty.focus(); return false; } count++; qty = MWJ_findObj('Quantity['+count+']'); minqty = MWJ_findObj('MinQuantity['+count+']'); } return true; } </SCRIPT> <?php include_once('../business/clsaffiliate.php'); if( $_SESSION["affiliate_id"] != ''){ $affiliate = new Affiliate(); $dir_name = $affiliate->getAffiliateDirecory($_SESSION["affiliate_id"]); $css = $affiliate->getAffiliateDirecory($_SESSION["affiliate_id"]); }else{ $dir_name = 'user'; $css = 'css'; } echo "<link rel=stylesheet href='../$css/style.css'>"; ?> <?php include('title.php') ?> <?php /*$_GET['update_delivery']=1; if(isset($_GET['update_delivery']) && $_GET['update_delivery']==1 ){ $str = "Quote Has Been Updated."; include_once('../business/mod_shipment.php'); $shipment = new ModShipment; $delivery_type = $gpc->pg('delivery_type'); $total_products = $gpc->pg('total_products'); $grand_total = $gpc->pg('grand_total'); echo "del" . $delivery_type . "tot" .$total_products. "grand" . $grand_total; //$shipment_charge = $shipment->appendShipmentCharge( $delivery_type); } else*/ $prodid = $_REQUEST['pid']; $catid = $_REQUEST['catid']; //$qty = $_REQUEST['qty']; $quote = $_REQUEST['quote']; //echo "Quote: ".$quote.'<br>'; $path = "../site_images/quote_images/"; $first = $_REQUEST['first']; $last = $_REQUEST['last']; $company = $_REQUEST['company']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $state = $_REQUEST['state']; $zip = $_REQUEST['zipCode']; $comments = $_REQUEST['comments']; $ImageName = $HTTP_POST_FILES['txtimage']['name']; //$ImageName = $_FILES["txtimage"]["name"]; $ImageExt = substr($ImageName, strpos($ImageName,'.')); $found = $_REQUEST['found']; //echo "catID" . $catid . "<br>ProdID" . $prodid . "<br>Qty" . $qty; if( isset($_GET['zipcode'])){ $_SESSION['zipcode'] = $_GET['zipcode']; $_SESSION['countrycode'] = "US"; //echo $_SESSION['zipcode']; //$zipcode_set = $_GET['zipcode']; //$country_code = "US"; } //elseif(isset($HTTP_GET_VARS['update']) && $HTTP_GET_VARS['update']==1 && $quote=="submit") elseif($quote=="submit") { //$str = "Quote Has Been Updated"; include_once('../business/clsshopping.php'); $cart = new ShoppingCart; include_once('../business/mod_shipment.php'); $shipment = new ModShipment; //$shipment_charge = $shipment->appendShipmentCharge(); include_once('../business/clscustomer.php'); $customer = new Customer; // $itemcount = $cart->GetCartItemCount($HTTP_SESSION_VARS['sessionid']); // $a=0; // while(1) // { // // if(!isset($HTTP_POST_VARS['cartitemid'][$a])){ // break; // } // // if($HTTP_POST_VARS['chkDelete'][$a]){ // $cart->DeleteOrder($HTTP_SESSION_VARS['sessionid'],$HTTP_POST_VARS['cartitemid'][$a]); // }else{ // $cart->EditOrder($HTTP_SESSION_VARS['sessionid'],$HTTP_POST_VARS['cartitemid'][$a], $HTTP_POST_VARS['Quantity'][$a]); // // } // $a++; // } $rsGetCartItems = $cart->GetCartItems($HTTP_SESSION_VARS['sessionid'], $HTTP_SESSION_VARS['loginusername'], $_SESSION['affiliate_id']); $viewpath = $_SERVER['PHP_SELF']; $viewpath = substr($viewpath,0,strrpos($viewpath,"/")); $viewpath = substr($viewpath,0,strrpos($viewpath,"/")); $subject = "Fast Office Quote Request"; $message = "<html><body><table border=0 cellspacing=0 cellpadding=5>"; $message .= "<tr bgcolor=#FFFFFF><td colspan=2>Here are the Requested Details:<br><br></td></tr>"; $message .= "<tr bgcolor=#FFFFFF><td colspan=2><table border=0 cellspacing=0 cellpadding=5 width=450>"; $message .= "<tr bgcolor=#FFFFFF><td width=33%><b>Product Code</b></td><td width=33%><b>Product Description</b></td> <td width=33%><b>Quantity</b></td></tr>"; if(!$rsGetCartItems->EOF) { while(!$rsGetCartItems->EOF) { $message .= "<tr bgcolor=#FFFFFF><td>". $rsGetCartItems->fields['ProductCode'] ." </td><td>". $rsGetCartItems->fields['ProductName'] ." </td><td>". $rsGetCartItems->fields['Quantity'] ."</td></tr>"; $rsGetCartItems->MoveNext(); } } else { $message .= "<tr bgcolor=#FFFFFF><td colspan=3><font color=red>You have not requested any items.</font><br><br></td></tr>"; } $message .= " </table></td></tr>"; $message .= "<tr bgcolor=#FFFFFF><td width=33%><b>First Name:</b></td><td> ". $first ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Last Name:</b></td><td align=left>". $last ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Company:</b></td><td> ". $company ." </td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Phone:</b></td><td> ". $phone ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Email:</b></td><td> ". $email ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>State:</b></td><td> ". $state ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Zip:</b></td><td> ". $zip ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Comments:</b></td><td>". htmlentities($comments,ENT_QUOTES) ."</td></tr> "; $message .= "<tr bgcolor=#FFFFFF><td><b>Upload Files:</b></td><td><a href='http://".$_SERVER['HTTP_HOST'].$viewpath."/site_images/quote_images/Quote_". $ImageName ."'>http://".$_SERVER['HTTP_HOST'].$viewpath."/site_images/quote_images/Quote_". $ImageName ."</a></td></tr>"; $message .= "<tr bgcolor=#FFFFFF><td><b>Found:</b></td><td>". $found ."</td></tr> "; $message .= "</table></body></html>\n "; /* 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 .= "From:$email <$email>\r\n"; $headers .= "Reply-To: $email\r\n"; /* recipients */ include_once('../business/clsutility.php'); $Utility = new Utility(); $rsAdminEmail = $Utility->SelectRecord("admin_emails","EmailName","Admin"); $AdminEmail = $rsAdminEmail->fields['Email']; //echo $AdminEmail; $to = "<$AdminEmail>"; /* and now mail it */ @mail($to, $subject, $message, $headers); if (!empty($ImageName)) { $FileName = "Quote_" . $ImageName; if (!copy($_FILES["txtimage"]["tmp_name"], $path.$FileName)) $msg = "<b>" . $ImageName . ":</b> not uploaded yet."; } include_once('../business/clsshopping.php'); $cart = new ShoppingCart; $cart->EmptyCart($HTTP_SESSION_VARS['sessionid']); $msg = "Your request has been successfully sent."; } elseif(isset($HTTP_GET_VARS['update']) && $HTTP_GET_VARS['update']==1 && $quote=="update") { $str = "Your Quote Has Been Updated."; include_once('../business/clsshopping.php'); $cart = new ShoppingCart; include_once('../business/mod_shipment.php'); $shipment = new ModShipment; //$shipment_charge = $shipment->appendShipmentCharge(); include_once('../business/clscustomer.php'); $customer = new Customer; $itemcount = $cart->GetCartItemCount($HTTP_SESSION_VARS['sessionid']); $a=0; while(1) { if(!isset($HTTP_POST_VARS['cartitemid'][$a])){ break; } if($HTTP_POST_VARS['chkDelete'][$a]){ $cart->DeleteOrder($HTTP_SESSION_VARS['sessionid'],$HTTP_POST_VARS['cartitemid'][$a]); }else{ $cart->EditOrder($HTTP_SESSION_VARS['sessionid'],$HTTP_POST_VARS['cartitemid'][$a], $HTTP_POST_VARS['Quantity'][$a]); } $a++; } } //elseif(isset($HTTP_GET_VARS['empty']) && $HTTP_GET_VARS['empty'] == 1){ // $str = "Your Quote Has Been Updated."; // include_once('../business/clsshopping.php'); // $cart = new ShoppingCart; // $cart->EmptyCart($HTTP_SESSION_VARS['sessionid']); //} //elseif(isset($HTTP_GET_VARS['add']) && $HTTP_GET_VARS['add']==0) //{ // $str = "The quantity you requested is greater than the quantity available in stock."; //} elseif(isset($HTTP_GET_VARS['add']) && $HTTP_GET_VARS['add']==1) { $str = "The product has been added to your cart."; } ?> </HEAD> <BODY> <!------- Starts of Center Structure Table --------> <TABLE border="0" cellPadding="0" cellSpacing="0" width="100%" style="margin-top: 35px;"> <FORM action='../user/shoppingcart.php?update=1' method='post' name='frmEditCart' enctype='multipart/form-data'> <INPUT type="hidden" name="quote" value=""> <TR> <TD width="52%" valign="top"> <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#F5F5F5" style="margin-left: 3px;"> <tr> <td> <!----------- Start of Working Table ----------------> <table cellpadding="5" cellspacing="0" width="100%" border="0" style="border:solid 1px #333333;"> <TR> <TD align="left" valign="top" bgcolor="#A0A0A0" class="tableheader">Quote Review </TD> </TR> <TR> <TD align="center" valign="top" class="txtNormal"> <?php if(isset($str) && $str!='') { ?> <FONT size='2' face='Arial, Helvetica, sans-serif'><?php echo $str ?></FONT> <?php } else echo "<BR>"; ?> <!---- Start of Cart Table -----> <TABLE width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF"> <INPUT type=hidden name="emptyGiftDiscount" > <INPUT type=hidden name="emptyDiscount" > <TR> <TD width="25%" align="left" valign="middle" style="border-bottom: solid 2px #eaeaea;" class="txtlinks2">Product #</TD> <TD width="48%" align="left" valign="middle" style="border-bottom: solid 2px #eaeaea;" class="txtlinks2">Description</TD> <TD width="16%" align="center" valign="middle" style="border-bottom: solid 2px #eaeaea;" class="txtlinks2">Quantity</TD> <TD width="11%" align="center" valign="middle" style="border-bottom: solid 2px #eaeaea;" class="txtlinks2">Remove</TD> </TR> <?php $subtotal = 0; include_once('../business/clsshopping.php'); include_once('../business/clsproduct.php'); include_once('../business/clscustomer.php'); $customer = new Customer; $cart = new ShoppingCart; // user name for whole salers $rs = $cart->GetCartItems($HTTP_SESSION_VARS['sessionid'], $HTTP_SESSION_VARS['loginusername'], $_SESSION['affiliate_id']); $counter = 0; if(!is_object($rs) or $rs->EOF ) { $IsEmpty = true; ?> <TR height="22"> <TD colspan="4"><Font class="txtError" style="padding-left:4px;"> <B>The Shopping Basket is Empty.</B></Font></TD> </TR> <?php } else { $total_products = 0; while(!$rs->EOF){ // to count the number of items in the cart $total_products += $rs->fields['Quantity']; $prod = new Product; $attrib = $prod->GetItemAttributeValues($rs->fields['Item_ID']); $popuptext = ""; while(!$attrib->EOF){ $popuptext .= $attrib->fields['Name'] . "=" . htmlentities($attrib->fields['Value'],ENT_QUOTES) . " : "; $attrib->MoveNext(); } $popuptext = substr($popuptext, 0, strlen($popuptext) - 3); ?> <TR> <TD align="left" valign="middle" class="txtlinks2" style="border-bottom: solid 2px #eaeaea;"> <?=htmlentities($rs->fields['ProductCode'],ENT_QUOTES);?> </TD> <TD align="left" valign="middle" class="txtlinks2" style="border-bottom: solid 2px #eaeaea;"> <A title="<?=$popuptext?>" class='linksCategory' href="../user/productdetail.php?pid=<?php echo $rs->fields['Product_ID'] ?>"> <?=htmlentities($rs->fields['ProductName'],ENT_QUOTES);?> </A></TD> <TD align="center" class="txtlinks2" style="border-bottom: solid 2px #eaeaea;"> <input type="text" name="Quantity[<?php echo $counter ?>]" value=<?=$rs->fields['Quantity']?> class='inputBox' maxlength=3 size=3 onFocus="EnableUpdate();"> <input type="hidden" name="MinQuantity[<?php echo $counter ?>]" value=<?=$rs->fields['MinOrderQuantity']?>> </TD> <TD align="center" valign="middle" class="txtlinks2" style="border-bottom: solid 2px #eaeaea;"> <INPUT name = 'chkDelete[<?=$counter?>]' type='checkbox' onpropertychange='EnableUpdate();' onclick='EnableUpdate();'></TD> <INPUT name = 'cartitemid[<?=$counter?>]' type='hidden' value = '<?=$rs->fields['Item_ID']?>'> </TR> <?php $rs->MoveNext(); $counter++; } ?> <INPUT name = 'total_products' type='hidden' value = '<?php $total_products ?>'> <?php } ?> </TABLE> <!---- Ends of Cart Table -----> </TD> </TR> <TR> <TD align="center"> <!----- Start of Update Cart -----> <TABLE cellspacing="0" cellpadding="2" width="100%" border="0"> <TR> <? if( $IsEmpty != true) { ?> <TD align="right"><input type='button' name='updatebasket' style='width:105px;' value='Update Quote' class='buttonStyleBlack' onClick="UpdateBasket();"></TD> <? } ?> </TR> <TR> <TD align="left"><input name="button2" type='button' class='buttonStyleBlack' style='width:135px;' value='Continue Shopping' onClick="ContinueShopping()"></TD> </TR> </TABLE> </TD> </TR> </table> <!----------- End of Working Table ----------------> </td> </tr> </table></TD> <? if($HTTP_GET_VARS['update']==1 && $_REQUEST['quote']=="submit") { ?> <? } else { ?> <TD valign="top" width="48%"> <!-------- Start of Submit Table -----------> <table width="453" border="0" cellpadding="5" cellspacing="0" bgcolor="#F5F5F5" style="border:solid 1px #333333;"> <tr bgcolor="#A0A0A0"> <td height="23" colspan="2" align="left" valign="top" class="tableheader">Submit Your Quote Request</td> </tr> <tr> <td width="165"> </td> <td align="left" valign="bottom" class="txtHeadingRed2Small">*required fields</td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">First Name*:</td> <td height="25" align="left" valign="middle" class="formfields"><input type="text" name="first" class="inputBox" style="width:120px; height:20px;"></td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">Last Name*:</td> <td height="25" align="left" valign="middle" class="formfields"> <input type="text" name="last" class="inputBox" style="width:120px; height:20px;"></td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">Company*:</td> <td height="25" align="left" valign="middle" class="formfields"><input type="text" name="company" class="inputBox" style="width:230px; height:20px;"></td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">Business Email*: </td> <td height="25" align="left" valign="middle" class="formfields"><input type="text" name="email" class="inputBox" style="width:230px; height:20px;"></td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">Business Phone*:</td> <td height="25" align="left" valign="middle" class="formfields"><input type="text" name="phone" class="inputBox" style="width:120px; height:20px;"></td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">State*:</td> <td height="25" align="left" valign="middle" class="formfields"> <input type="text" name="state" class="inputBox" style="width:40px; height:20px;" maxlenght="40"> (for shipping calculation)</td> </tr> <tr> <td width="165" height="25" align="right" valign="middle" class="formred">Zip Code*:</td> <td height="25" align="left" valign="middle" class="formfields"><input type="text" name="zipCode" class="inputBox" style="width:70px; height:20px;" maxlength="5"> (for shipping calculation)</td> </tr> <tr> <td width="165" align="right" valign="top" class="formfields">Comments:</td> <td width="333" align="left" valign="middle"><textarea name="comments" style="width:290px; height:100px;" class="inputBox"></textarea></td> </tr> <tr> <td align="center" height="25" colspan="2" class="formred">How Did You Hear About Us?* <select name="found" size="1"> <option value="Email">Email</option> <option value="Search Engine">Search Engine</option> <option value="Biz Reference">Business Reference</option> <option value="Past Client">Past Client</option> </select></td> </tr> <tr> <td colspan="2" align="left" class="formfields"><br>If you have a floorplan /.pdf / AutoCad file of your requirements, please attach the file to your quote request. </td> </tr> <tr> <td align="right" valign="middle" class="formtext">Attach File:</td> <td align="left" valign="middle"><input type="file" name="txtimage" onKeydown ='this.blur()' class="inputFile"></td> </tr> <tr> <td align="center" height="34" colspan="2" valign="middle" class="txtHeadingRed2"><input name="button" type="button" class="buttonStyleBlack" onClick="SubmitForQuote();" value="Submit Quote"></td> </tr> <tr align="center"> <td colspan="2" class="formtext">*We will never sell or rent your contact information to a third party</td> </tr> </table> <!-------- End of submit Table -----------> </TD> <? } ?> </TR> </FORM> </TABLE> <!------- End of Center Structure Table --------> Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/ Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 Well this isnt really gunna help ur problem but... since u posted ur website i decided to check for security... heres my results... http://fastoffice.com/user/products.php?catid=17' when adding a ' to it, u get sql injection. very dangerous same for when u use a letter Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534475 Share on other sites More sharing options...
fastoffice Posted May 6, 2008 Author Share Posted May 6, 2008 Well this isnt really gunna help ur problem but... since u posted ur website i decided to check for security... heres my results... http://fastoffice.com/user/products.php?catid=17' when adding a ' to it, u get sql injection. very dangerous same for when u use a letter I'm not sure what that means. I am a newbie with PHP (read that as very LITTLE knowledge). As for security we don't collect any personal info like credit card numbers through the cart. Our cart is simply for selecting and submitting product choices via formmail. We then call them back to give prices and get personal info to process the order. What can someone do with the info they getif they do what you did? what can be done to filter out escape characters (if thats the right term)? Kevin Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534506 Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 use this once you get your catalogue id number and theres two things you can do... Make sure you only get the number outputter <? $catid= $_GET['catid']; $catid= intval($catid); ?> or the preferred way to filter bad characters... <? $catid= htmlentities($_GET['catid']); ?> Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534507 Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 Okay i think ive come up with 2 possible solutions for your main problem... (after reading soo much of it ) Solution 1 --------------------------------- Put this at the top of your javascript snippet... function redirect(){ window.location='thankyouforchoosingourwonderfulwebsite.php'; //change to something appropriate. } then change this... function UpdateDelivery() { //here update the delivery type and the shipment charges var delivery_id = MWJ_findObj('delivery_id'); var url = '../user/shoppingcart.php'; url = url+"?update_delivery=1"; document.location.href = url; } to function UpdateDelivery() { //here update the delivery type and the shipment charges var delivery_id = MWJ_findObj('delivery_id'); var url = '../user/shoppingcart.php'; url = url+"?update_delivery=1"; redirect(); } ------------------------------------------- Solution 2---------------------------------- Or you can try... function UpdateDelivery() { //here update the delivery type and the shipment charges var delivery_id = MWJ_findObj('delivery_id'); var url = '../user/shoppingcart.php'; url = url+"?update_delivery=1"; window.location= url; } ------------------------------------------- Solution 3---------------------------------- Or do this... function UpdateDelivery() { //here update the delivery type and the shipment charges var delivery_id = MWJ_findObj('delivery_id'); var url = '../user/shoppingcart.php'; url = url+"?update_delivery=1"; <? header ("../user/shoppingcart.php"); ?> } ---------------------------- To be honest im not sure if any of them would work Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534512 Share on other sites More sharing options...
fastoffice Posted May 6, 2008 Author Share Posted May 6, 2008 Thanks! sorry about all the code in there. Once I get the redirect to work I'll be systematically taking the junk out of the cart page that isn't being used to streamline to page A LOT. I'll try all your suggestions and see if any works. If they do I'll be back to give you kudos. Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534581 Share on other sites More sharing options...
fastoffice Posted May 6, 2008 Author Share Posted May 6, 2008 None of the suggestions worked :'( function UpdateDelivery() doesn't have anything to do with the form submission. It has to do with updating the delivery type and the shipment charges. I'm sure it has to do with this somehow but unsure what needs to be tweaked: <FORM action='../user/shoppingcart.php?update=1' method='post' name='frmEditCart' enctype='multipart/form-data'> <INPUT type="hidden" name="quote" value=""> Link to comment https://forums.phpfreaks.com/topic/104400-form-submit-the-redirect-perplexed/#findComment-534735 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.