Jump to content

[SOLVED] IE wont display PHP on a page


mark110384

Recommended Posts

A bit of a strange one, I've been developing some code for a shopping cart, it works fine in FireFox bit when I tried it in IE one of the pages didn't work, it is as though the PHP isn't even there or the HTML table that contains the PHP for that matter. Could anyone shed any light on this problem?

Link to comment
Share on other sites

<?

/*#############################################################

- Script Name: addcart.php                                    -

- Description: Add a selected item to the table cart_items,  -

- check if it already exist and update and insert accordingly -

#############################################################*/

 

session_start();

 

$session = session_id();

 

session_register($session);

 

//Get values from itemdesc.php

 

$qty = $_POST["qty"];

$itemname = $_POST["itemName"];

$price = $_POST["price"];

$itemid = $_POST["itemId"];

$createdate = date("Y-m-d G:i:s");

 

?>

 

<table width = "800" border = "0" cellpadding="0" cellspacing ="0" bgcolor="#0099CC"  align="center">

<tr>

<td><font face = "Arial" size ="4"><? echo $itemname; ?> was added to your shopping trolley.</font></td>

</tr>

</table>

 

<?

 

include("function.php");

 

//Get a connection to the database

$connect = @ConnectToDb($dbhost, $dbuser, $dbname);

 

//Update the session timestamp

$updatesession = @UpdateSessionDate($newdate, $session);

 

//Find itemId sent via viewitems.php addtotrolley button

 

$sqlfinditem = "SELECT * FROM items WHERE itemId = '$itemid'";

 

$queryresult = mysql_query($sqlfinditem);

 

while($myrow = mysql_fetch_array($queryresult))

{

$itemname = $myrow['itemName'];

$itemdesc = $myrow['itemDesc'];

$price = $myrow['price'];

$imagepath = $myrow['imagePath'];

$alt = $myrow['alt'];

 

 

//Set Quantity to = 1 if quantity string is empty otherwise preceed

 

if (!$qty)

{

$quant = 1;

}

else

{

$quant = $qty;

}

 

//Search to see if the itemId already exist within cart_items

 

$sqlselect = "SELECT * FROM cart_items WHERE itemId = '$itemid' and session = '$session'";

 

$result = mysql_query($sqlselect);

 

$itemcount = mysql_num_rows($result);

 

$itmid = "";

 

$itmid = $myrow['itemId'];

 

//Count the number of rows found and less than or = to 0 insert in cart

 

if ($itemcount <= 0)

{

//$qty =mysql_real_escape_string($qty);

 

$sqlinsert= "INSERT INTO cart_items (itemId, price, quantity, session, createdate) values ('$itemid', '$price','$quant', '$session', '$createdate')";

 

if (mysql_query($sqlinsert))

{

?>

<table width="671" border="0" cellspacing="0" cellpadding="0">

<tr>

  <td width="339"></td>

    <td width="393"><table width="393" border="0" cellspacing="0" cellpadding="0">

    <tr><td width="100"><? echo "<img src = '$imagepath' alt = '$alt' height = 200 width = 200 border = 0/>"; ?></td>

<td width="217"><table width="227" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><? echo "<font face= Arial size = 2><b>£</b>" ."<b>$price /Each</b><br></font>";?></td>

</tr>

<tr>

<td><? echo "<font face=Arial size = 2><b>$itemid $itemname</b></font>";?></td>

</tr>

<tr>

<td height ="150"></td>

</tr>

</table></td>

</tr>

</table>

<?

}

else

{

echo "Error! Failed to add item to cart.";

}

}

else

{

  $quantity ="";

 

while($myrow = mysql_fetch_array($result))

{

 

$quantity = $myrow['quantity'];

 

}

 

$totalqty = $quantity + $quant;

 

// Else if itemid exists in cart_items update with new data

 

mysql_query ("UPDATE cart_items SET quantity = '$totalqty' WHERE itemId = '$itemid' and session  = '$session'");

?>

<table width="671" border="0" cellspacing="0" cellpadding="0">

<tr>

  <td width="339"></td>

    <td width="393"><table width="393" border="0" cellspacing="0" cellpadding="0">

    <tr><td width="100"><? echo "<img src = '$imagepath' alt = '$alt' height = 200 width = 200 border = 0/>"; ?></td>

<td width="217"><table width="227" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><? echo "<font face= Arial size = 2><b>£</b>" ."<b>$price /Each</b><br></font>";?></td>

</tr>

<tr>

<td><? echo "<font face=Arial size = 2><b>$itemid $itemname</b></font>";?></td>

</tr>

<tr>

<td height ="150"></td>

</tr>

</table></td>

</tr>

</table>

<?

}

//}

 

?>

<html>

<head>

</head>

<title>Lilley and Gillie - <? echo "$itemname successfully added to your shopping trolley";?></title>

<body>

 

<table width="350" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="60"></td>

<td></td>

</tr>

<tr>

<td height="38"><a href="viewitems.php"><img src = "continueshopping.bmp" border = "0"/></a></td>

<td><a href="cart.php"><img src = "viewcartbutton.bmp" border = "0"/></a></td>

</tr>

</table>

</body>

<?

}

?>

</html>

 

Link to comment
Share on other sites

Yeah this is the source code from IE

 

<table width = "800" border = "0" cellpadding="0" cellspacing ="0" bgcolor="#0099CC"  align="center">

<tr>

<td><font face = "Arial" size ="4"> was added to your shopping trolley.</font></td>

</tr>

</table>

 

</body>

</html>

 

 

 

And the following in Firefox

 

<table width = "800" border = "0" cellpadding="0" cellspacing ="0" bgcolor="#0099CC"  align="center">

<tr>

<td><font face = "Arial" size ="4"> was added to your shopping trolley.</font></td>

</tr>

</table>

 

<table width="671" border="0" cellspacing="0" cellpadding="0">

<tr>

  <td width="339"></td>

    <td width="393"><table width="393" border="0" cellspacing="0" cellpadding="0">

 

    <tr><td width="100"><img src = 'F0750.JPG' alt = 'Set Square Image' height = 200 width = 200 border = 0/></td>

<td width="217"><table width="227" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><font face= Arial size = 2><b>£</b><b>2.99 /Each</b><br></font></td>

</tr>

<tr>

<td><font face=Arial size = 2><b>F0750 Set Square</b></font></td>

 

</tr>

<tr>

<td height ="150"></td>

</tr>

</table></td>

</tr>

</table>

<html>

<head>

 

</head>

<title>Lilley and Gillie - Set Square successfully added to your shopping trolley</title>

<body>

 

<table width="350" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="60"></td>

<td></td>

</tr>

<tr>

<td height="38"><a href="viewitems.php"><img src = "continueshopping.bmp" border = "0"/></a></td>

<td><a href="cart.php"><img src = "viewcartbutton.bmp" border = "0"/></a></td>

</tr>

</table>

</body>

</html>

 

 

Link to comment
Share on other sites

The following is coding for the button passing the itemid over if its any help

 

<? echo "<input type='image' src='addtotrolley.bmp' border='0' alt='Add' value = '$itemid' name = 'itemId'/>";?>

Thats isn't valid php.

 

<?php echo "<input type='image' src='addtotrolley.bmp' border='0' alt='Add' value = '$itemid' name = 'itemId'/>"; ?>

Link to comment
Share on other sites

The following is coding for the button passing the itemid over if its any help

 

Quote

<? echo "<input type='image' src='addtotrolley.bmp' border='0' alt='Add' value = '$itemid' name = 'itemId'/>";?>

 

Thats isn't valid php.

 

<?php echo "<input type='image' src='addtotrolley.bmp' border='0' alt='Add' value = '$itemid' name = 'itemId'/>"; ?>

 

???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.