SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Jul 8, 2006, 22:13 #1
- Join Date
- Jun 2004
- Location
- Vancouver
- Posts
- 105
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP & Internet Explorer problem or may be server problem..
Please close this. My dumb mistake. I exported the sql file to the webserver and forgot to set id to auto_increment.
Last edited by Animedude; Jul 9, 2006 at 01:05.
-
Jul 8, 2006, 22:30 #2
- Join Date
- Mar 2006
- Posts
- 6,132
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you can do print_r($_POST) and same for _GET to see if you script is being sent the variables/values you expect it to be.
in addition, it can be helpful to set error reporting to display notices to help you track undefined variables.
PHP Code:error_reporting(E_ALL);
ini_set('display_errors', 1);
-
Jul 8, 2006, 23:18 #3
- Join Date
- Jun 2004
- Location
- Vancouver
- Posts
- 105
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Firefox displays this:
Array ( [q] => 3 [referer] => scania [p] => sc1 [submit2_x] => 35 [submit2_y] => 2 [submit2] => submit )
Internet Explorer displays this:
Array ( [q] => 4 [referer] => scania [p] => sc1 [submit2_x] => 24 [submit2_y] => 5 )
I am speculating that it is server related since it worked in both browsers on the offline server. For web server, only firefox works.
Or it could relate to internet explorer's problem with image submit button.
the form code
PHP Code:echo "<tr><form action=\"cart.php?action=add\" method='post'>
<td class='center_col3' height='25'><span class='style_amount'>".$row['name']."</span></td>
<td class='center_col3' height='25'><span class='style_cash'>".$row['price']."</span></td>
<td class='center_col3' height='25'>
<select name='q' class='style_dropmenu'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
</select></td>
<td valign='middle' class='center_col3' height='25'><input type='hidden' name='referer' value='".$server_id."'><input type='hidden' name='p' value='".$row['itemcode']."'><input onmouseover='this.src=\"images/ordero.gif\"'
onmouseout='this.src=\"images/order.gif\"'
type='image' name='submit2' value='submit'
src=\"images/order.gif\" border='0' alt='Add to cart'></td></form>
</tr>";
PHP Code:case "add":
if(isset($_POST['p']) and isset($_POST['q'])) $cart->add_item($_POST['p'],$_POST['q']);
break;
PHP Code:function add_item($itemcode, $quantity) {
$qty = $this->check_item($itemcode);
if($qty == 0) {
$query = "INSERT INTO ".$this->cart_table . " (session, itemcode, quantity) VALUES ('".$this->cart_id."', '$itemcode', '$quantity') ";
mysql_query($query, $this->dblink);
} else {
$quantity += $qty;
$query = "UPDATE ".$this->cart_table . " SET quantity='$quantity' WHERE session='".$this->cart_id."' AND itemcode='$itemcode' ";
mysql_query($query, $this->dblink);
}
return true;
}
-
Jul 8, 2006, 23:33 #4
- Join Date
- Mar 2006
- Posts
- 6,132
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
with input type="image" IE only sends the coordinates of the click, hence the _x _y vars. firefox also sends the name as is in addition to the coords.
as far as i know this is IE's only behavior, i wasnt aware that IE ever sends the name as is. are you positive it worked on your offline server? i would think not.
-
Jul 8, 2006, 23:37 #5
- Join Date
- Jun 2004
- Location
- Vancouver
- Posts
- 105
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Please close this. My dumb mistake. I exported the sql file to the webserver and forgot to set id to auto_increment.
Bookmarks