Hi All,
I am new to PHP and I got stuck on how to display a variable "txtQty" in my PHP COde. What happen is user will key in a number and I just try to display the number in the same PHP program. Here is the program.
Tks in advance
<?php
if (!defined('WEB_ROOT')) {
exit;
}
$product = getProductDetail($pdId, $catId);
// we have $pd_name, $pd_price, $pd_description, $pd_image, $cart_url
extract($product);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center"><img src="<?php echo $pd_image; ?>" border="0" alt="<?php echo $pd_name; ?>"></td>
<td valign="middle">
<strong><?php echo $pd_name; ?></strong><br>
Price : <?php echo displayAmount($pd_price); ?><br>
Posting : <?php echo displayAmount($pd_posting); ?><br>
Quantity : <input [COLOR="Red"]name="txtQty"[/COLOR] type="text" id="txtQty" size="3" class="box" onKeyUp="checkNumber(this);"> <br>
<?php
// if we still have this product in stock
// show the 'Add to cart' button
[COLOR="Red"]echo "This is the qty : " . $txtQty;
echo "This is the 2nd line qty : " . $_REQUEST["txtQty"];
echo "This is the 3nd line qty : " . $_POST["txtQty"];[/COLOR]
if ($pd_qty > 0) {
?>
<input type="button" name="btnAddToCart" value="Add To Cart >" onClick="window.location.href='<?php echo $cart_url; ?>';" class="addToCartButton">
<?php
} else {
echo 'Out Of Stock';
}
?>
</td>
</tr>
<tr align="left">
<td colspan="2"><?php echo $pd_description; ?></td>
</tr>
</table>