Hello,
As I am relatively new to PHP, and I am learning at a time when there is a lot of info both in books and on the internet, that spans the two methods of passing form globals between pages, I seem to be getting a bit confused. Especially when I try something that is supposed to be the way to do it properly and it still does not work. Below is some code that is simply supposed to take a product code and pass it to my shopping cart script. I have used bith what you see here ($HTTP_POST_VARS) and the $POST method. When I try to print it out on the target page it gives me nothing. I simply use echo "The item number is " . $POST['itemSku'];
Have I missed a comma. a brace .. the whole concept ... what? My server is set with the default register_globals off.
<?php display_button("products", "cart.php?itemSku=" . $HTTP_POST_VARS[$row_displayCatProd['itemSku']] . "", "add-to-cart", "Add ".$row_displayCatProd["itemName"]." To My Shopping Cart");?>
Here is the code for the function display_button;
function display_button($page, $target, $image, $alt)
{
//echo "The target page is $target";
if($page=="products")
echo "<center><a href=\"$target\"><img src=\"assets/images/mini-"."$image".".gif\"
alt=\"$alt\" border=0 height = 10 width = 110></a></center>";
else
echo "<center><a href=\"$target\"><img src=\"assets/images/$image".".gif\"
alt=\"$alt\" border=0 height = 24 width = 107></a></center>";
}
This function simply displays the proper button with the links attached.
Any help and patience is appreciated.
Cheers
Dave