Re: undefined variable
| From: | Smart Software | Date: | Sun, 30 Apr 2006 20:44:46 +0000 |
| Subject: | Re: undefined variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-235166@lists.php.net to get a copy of this message | ||
isset always returns 0
i create dynamic textbox called quantity0, textbox1, textbox3.......
then i a, trying to get the content of the textbox but it is always 0.
as you can see, i tried the suggestions but it still dont work.
is there something iam doing wroing? why is the textbox always 0?
<table width="700">
<? $query1 = mysql_query("SELECT * FROM products where product_group='$cat'
order by position");
$counter = 0;
while ($rowType = mysql_fetch_array($query1))
{
$textbox="quantity";
$textbox= "$textbox$counter"; //variable is set to quantity0, quantity1,
quantity2 etc
?>
<td width="30%">New row number: <? echo $counter; ?></td>
<td width="30%">name of textbox: <? echo $textbox; ?></td>
<? //below the textbox will be created?>
<td width="10%"><input id="<? $textbox ?>" name="<?
$textbox ?>"
type="text" value="1" size="1" maxlength="3"></td>
<?
//get content of textbox
$q = isset($_REQUEST['$textbox']) ? $_REQUEST['$textbox'] : 0;
?>
<td width="10%"> <a href=" <? echo
"products.php?quantity=$q"; ?>"
</a>TEST</td>
<td width="20%"> <? echo "content of textbox: $q"; ?> </td>
</tr>
<?
$counter++;
}
?>
</table>