Here is what i'm doing. I have an add to cart form that i wanted to convert to a variable so it would only be displayed if the item price was not equal to "SOLD OUT", I've managed to work my way through this, but now the problem comes in getting my add to cart form to actually work when it is displayed.
here are the pages and code I'm working on. http://www.oatesj77.com/oldsite/unklbra ... ynamic.php and the code is: http://www.oatesj77.com/oldsite/unklbra ... ynamic.txt
this page has items linking to a details page where the form is displayed/not displayed.
http://www.oatesj77.com/oldsite/unklbra ... etails.php and the code is http://www.oatesj77.com/oldsite/unklbra ... etails.txt
when you get to the detail page, you can see that i have two add to cart forms, one that is pulled from the variable and doesn't work, and the other is just the form, but it works.
basically what i'm trying to do is convert
Code: Select all
<form name="e;unklbrandcart_1_ATC_<?php echo $row_rsToysї'ProdID']; ?>"e; method="e;POST"e; action="e;<?php echo $_SERVERї"e;PHP_SELF"e;]; ?><?php echo (isset($_SERVERї"e;QUERY_STRING"e;]) && $_SERVERї"e;QUERY_STRING"e;] != "e;"e;)?"e;?"e;.$_SERVERї"e;QUERY_STRING"e;]:"e;"e;; ?>"e;>
<input type="e;hidden"e; name="e;unklbrandcart_1_ID_Add"e; value="e;<?php echo $row_rsToysї'ProdID']; ?>"e; >
<input type="e;image"e; src="e;images/add-to-cart.gif"e; border="e;0"e; value="e;Add To Cart"e; name="e;unklbrandcart_1_ATC"e; alt="e;add to cart"e;>
</form>Code: Select all
<?php
$cartform = '<form name="unklbrandcart_1_ATC_'.$row_rsToys["ProdID"].'" method="post" action="'.$_SERVER["PHP_SELF"].' '.$_SERVER["QUERY_STRING"].'">
<input type="hidden" name="unklbrandcart_1_ID_Add" value="'.$row_rsToys["ProdID"].'">
<input type="image" src="images/add-to-cart.gif" border="0" value="Add To Cart" name="unklbrandcart_1_ATC" alt="add to cart">
</form>';
?>Code: Select all
<?php
$prodPrice=$row_rsToys['ProdPrice'];
$nfs="Not For Sale";
if ($prodPrice!="SOLD OUT") {echo $cartform;}
else {echo $nfs;}
?>