Is it possible to create a variable with another variable?
I would like to create a form element like this in PHP...
while ($Row = mysql_fetch_array ($Result)) {
print ("<input type=\"text\" size=\"4\" name=\"q$Row[Item]\">\n"
}
The requested input is for a quantity of items to order. A WHILE statement runs through the entire database of items to produce something like this in HTML on the form submission page...
<input type="text" size="4" name="qapples">
<input type="text" size="4" name="qpears">
<input type="text" size="4" name="qbananas">
The problem occurs when I want to handle the form-submitted data.
I ignorantly try the following code for handling the data on the form handler page...
while ($Row = mysql_fetch_array ($Result)) {
if ($q$Row[Item]) {
print ("You want $q$Row[Item] of $Row[Item]<br>\n"
}}
This last code does not work, of course, and I find myself begging for the gift of wisdom. Is there a way to do this? How can '$q$Row[Item]' be interpreted as a single variable?
I would like to create a form element like this in PHP...
while ($Row = mysql_fetch_array ($Result)) {
print ("<input type=\"text\" size=\"4\" name=\"q$Row[Item]\">\n"
}
The requested input is for a quantity of items to order. A WHILE statement runs through the entire database of items to produce something like this in HTML on the form submission page...
<input type="text" size="4" name="qapples">
<input type="text" size="4" name="qpears">
<input type="text" size="4" name="qbananas">
The problem occurs when I want to handle the form-submitted data.
I ignorantly try the following code for handling the data on the form handler page...
while ($Row = mysql_fetch_array ($Result)) {
if ($q$Row[Item]) {
print ("You want $q$Row[Item] of $Row[Item]<br>\n"
}}
This last code does not work, of course, and I find myself begging for the gift of wisdom. Is there a way to do this? How can '$q$Row[Item]' be interpreted as a single variable?