aebstract Posted February 4, 2009 Share Posted February 4, 2009 I was thinking this was a basic html issue, but I think it's in to the php. (may be wrong) It seems whenever I click my button to process the script, it won't finish through in IE but does fine in Firefox. Note that I am using an image as the submit button. Here is the page: <?php header("Cache-control: private"); if(!isset($_SESSION["id"])) { header("Location: index.php?page=login"); exit; } echo '<pre>', print_r($_POST), '</pre>'; $product_cat = $_GET['product_cat']; $checknum = 1; $result = mysql_query("SELECT * FROM `p_products` WHERE category='$product_cat'") or DIE(mysql_error()); while($r = mysql_fetch_array($result)) { $id = $r['id']; $partnumber = $r['partnumber']; $partname = $r['partname']; $description = $r['description']; $price = $r['price']; $option1 = $r['option1']; $specialid = $id; $postname = image.$id; $postsize = size.$id; if (isset($_POST[$postname])) { $error = 0; if (isset($_POST['hideme'])) { if (empty($_POST[$postsize])){ $error = 1; $errormsg = "You must fill in a Pipe Size for $partname."; } else { $sizenum = $_POST[$postsize]; $specialid = $id.";".$sizenum; } } if ($error == 1){ $errordisplay .= "<div id=\"error_box\"> $errormsg</div>"; } else { $materialid = material.$id; $finishid = finish.$id; $material = $_POST[$materialid]; $finish = $_POST[$finishid]; if (isset($_SESSION['cart'][$id][$material][$finish])) { foreach ($_SESSION['cart'] as $id2 => $array2){ if ($id2 == $id) { foreach ($array2 as $material2 => $array3){ if ($material2 == $material) { foreach ($array3 as $finish2 => $array4){ if ($finish2 == $finish) { $newqty = $array4['qty']; $newqty ++; if (isset($array4['size'])) { $_SESSION['cart'][$id][$material][$finish] = array(qty => $newqty, size => $array4['size']); } else { $_SESSION['cart'][$id][$material][$finish] = array(qty => $newqty); } header("Location: index.php?page=cart"); exit; } } } } } } } else { if (isset($_POST['hideme'])) { $setsize = size.$id; $_SESSION['cart'][$id][$material][$finish] = array(qty => 1, size => $_POST[$setsize]); } else { $_SESSION['cart'][$id][$material][$finish] = array(qty => 1); } header("Location: index.php?page=cart"); exit; } } } if (!empty($option1)){ $clicker = " <table> <tr><td align=\"right\"> Material: </td><td> <select name=\"material$id\" style=\"background-color: #FFFFFF; border: solid 1px #000000; height: 20px; font-size: 10px;\"> <option value=\"Stainless\">Stainless Steel</option> <option value=\"Mild\">Mild Steel</option> </select> </td></tr> <tr><td align=\"right\"> Finish: </td><td> <select name=\"finish$id\" style=\"background-color: #FFFFFF; border: solid 1px #000000; height: 20px; font-size: 10px;\"> <option value=\"Uncoated\">Uncoated</option> <option value=\"Black\">Black</option> <option value=\"Other\">Other</option> </select> </td></tr> <tr><td align=\"right\"> Pipe Size: </td><td> <input type=\"text\" size=\"4\" value=\"\" name=\"size$id\" style=\"background-color: #FFFFFF; border: solid 1px #000000; height: 20px; font-size: 10px;\" /><br /> </td></tr> </table> <div class=\"product_image\"> <input type=\"hidden\" name=\"hideme\" value=\"needsize\" /> <input type=\"image\" value=\"submit$id\" src=\"addtocart.jpg\" width=\"144\" height=\"34\" border=\"0\" alt=\"Add to Cart\" name=\"image$id\"> </div>"; } else { $clicker = " <table> <tr><td align=\"right\"> Material: </td><td> <select name=\"material$id\" style=\"background-color: #FFFFFF; border: solid 1px #000000; height: 20px; font-size: 10px;\"> <option value=\"Stainless\">Stainless Steel</option> <option value=\"Mild\">Mild Steel</option> </select> </td></tr> <tr><td align=\"right\"> Finish: </td><td> <select name=\"finish$id\" style=\"background-color: #FFFFFF; border: solid 1px #000000; height: 20px; font-size: 10px;\"> <option value=\"Uncoated\">Uncoated</option> <option value=\"Black\">Black</option> <option value=\"Other\">Other</option> </select><br /> </td></tr> </table> <div class=\"product_image\"> <input type=\"image\" value=\"submit$id\" src=\"addtocart.jpg\" width=\"144\" height=\"34\" border=\"0\" alt=\"Add to Cart\" name=\"image$id\"> </div>"; } if( $odd = $checknum%2 ) { $content .= " <form action=\"index.php?page=product_page&product_cat=$product_cat\" method=\"post\" name=\"add_product$id\"> <div class=\"product_left\"> <div class=\"product_image\"><img src=\"products/$partnumber-cart.jpg\" class=\"jkimagelarge\" title=\"products/$partnumber.jpg\" height=\"100\"/></div> <div class=\"product_info\"> $partname <br /> $partnumber <br /> $$price <br /><br /> $clicker</div></div> </form>"; } else { $content .= " <div class=\"product_right\"> <form action=\"index.php?page=product_page&product_cat=$product_cat\" method=\"post\" name=\"add_product$id\"> <div class=\"product_image\"><img src=\"products/$partnumber-cart.jpg\" class=\"jkimagelarge\" title=\"products/$partnumber.jpg\" height=\"100\"/></div> <div class=\"product_info\"> $partname <br /> $partnumber <br /> $$price <br /><br /> $clicker</div></div> <div class=\"productspace\"></div> </form>"; } $checknum ++; } ?> With the echo "$_POST" I get this displayed: Array ( [material11] => Stainless [finish11] => Uncoated [size11] => [hideme] => needsize [image11_x] => 36 [image11_y] => 16 ) 1 Then the page is just sitting there as if it hadn't changed a bit. Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/ Share on other sites More sharing options...
premiso Posted February 4, 2009 Share Posted February 4, 2009 My instinct says try removing header("Cache-control: private"); And see if it works on IE. Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754474 Share on other sites More sharing options...
aebstract Posted February 4, 2009 Author Share Posted February 4, 2009 Nope :'( Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754499 Share on other sites More sharing options...
aebstract Posted February 4, 2009 Author Share Posted February 4, 2009 Right here: if (isset($_POST[$postname])) { is where the script dies in IE. I can echo information above this and not below it (inside it). Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754518 Share on other sites More sharing options...
premiso Posted February 4, 2009 Share Posted February 4, 2009 $postname = "image" . $id; $postsize = "size" . $id; Do that, unless "image" and "size" were constants. That is the only spot I would see that would "cause" issues. Not sure why it is IE specific... Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754558 Share on other sites More sharing options...
aebstract Posted February 4, 2009 Author Share Posted February 4, 2009 Yeah that didn't do the trick either and I really don't know why it is IE specific either, it's bugging the hell out of me though. I just tested on IE on another machine to make sure it wasn't my pc somehow and still had the same issue. Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754562 Share on other sites More sharing options...
PFMaBiSmAd Posted February 4, 2009 Share Posted February 4, 2009 This is one case where IE is following the HTML specification for images as a submit button - http://us2.php.net/manual/en/faq.html.php#faq.html.form-image Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754563 Share on other sites More sharing options...
aebstract Posted February 4, 2009 Author Share Posted February 4, 2009 So is that what is messing it up? Is this something that would be easier to fix by changing over to normal submit buttons and using css to make the button an image, or is there another fix that wouldn't be too bad? Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754569 Share on other sites More sharing options...
aebstract Posted February 4, 2009 Author Share Posted February 4, 2009 Switching over to submit buttons instead of image buttons, seems to be fixing the problem. Thanks for that. Quote Link to comment https://forums.phpfreaks.com/topic/143791-solved-having-a-post-issue-in-ie/#findComment-754590 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.