wow that was fast!
Thank you guys it worked just fine when I put .$_SERVER['PHP_SELF'].
Why it didn't work the other way with <?php $php_self?
Now how can I do the following. I want my page which is a catalog product page to dinamically build a column inside a table showing my shopping basket . I already have the code for the shopping basket which I took from a tutorial my problem is that I don't know where to place the code to build that column.
Here is the code of the catalog page.
This is at the very beginning
<?PHP
session_start();
include ("basket.php");
?>
and later on in the page I have:
for ($i=0; $i<$num_rows; $i++) {
// fetch row
$img_info = mysql_fetch_array($result);
// create and return the img-tag and create the article information to append to the cart image
$img = '<img src="'.$img_dir.$img_info["imgfile"].'" width="206" height="160" border="1"/>';
$cart = '?id='.$img_info["productId"].'&price='.$img_info["price"].
'&basket='.$img_info["title"].'">';
//return $img;
//This is where I build the html table and where I want to build the column that shows the shopping cart
echo '<tr><td width="21%">'.$img.'</td>';
echo '<td align="justify" width="34%">'.$img_info["title"].'<p>'.$img_info["description"].'</p></td>';
echo '<td align="center" width="26%">$'.$img_info["price"].'</td>';
echo '<td align="center" width="19%"><a href="' .$_SERVER['PHP_SELF'].$cart.'<img src="Images/add-to-cart.gif" alt="add to cart"
width="113" height="20" border="0"/></a></td></tr>';
}
and finally the basket.php (the file that is included in the previous page) code that handles the printing of the shopping cart is
//Displays the basket if there are items in it.
if ($ses_basket_items>0){
for ($basket_counter=0; $basket_counter < $ses_basket_items; $basket_counter++){
// Go through the basket and print out each line
// You can of course format this to be in a table
// The formatting is needed to display the cents of your order. .00 will not display
// if not formatted .
$price=sprintf("%01.2f",$ses_basket_price[$basket_counter]);
$amount=$ses_basket_amount[$basket_counter];
$name=$ses_basket_name[$basket_counter];
//at this point I have the info of the shopping cart. Now how can I build that column since this is a diferent file
echo "$amount $name $price";
echo "<BR>\n";
}
Any thoughts? Did I make myself clear?
Thank you guys!