ejsmith67
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by ejsmith67
-
-
Here is the generated html form :
[code]
<TR bgcolor=#CCFF99>
<td>
<select name="iPItemNum[]">
<option selected>
<option value="13">Artichokes
<option value="25">Baby Clams
<option value="14">Bacon
<option value="54">Bill's Apple Bread Pudding
<option value="58">Biscotti
</select>
</td>
<td>
<select name="iPSizeNum[]">
<option selected>
<option value="14">1 lb.
<option value="15">3 lb.
<option value="16">5 lb.
<option value="13">8oz Cup
</select>
</td>
<td>
<input type="text" name="iPrice[]" size="10">
</tr>
[/code]
repeated 20 times
testing the receiving page with the code you provided :
[code]
foreach($_POST["iPItemNum"] as $key => $val)
{
echo $key . " = " . $val;
}
foreach($_POST["iPSizeNum"] as $key => $val)
{
echo $key . " = " . $val;
}
foreach($_POST["iPrice"] as $key => $val)
{
echo $key . " = " . $val;
}
[/code]
yields no output, but the dump of the quiry string is :
iPItemNum%5B%5D=13&iPSizeNum%5B%5D=16&iPrice%5B%5D=10.00&iPItemNum%5B%5D=54&iPSizeNum%5B%5D=17&iPrice%5B%5D=3.50
I dont mean to be dense, but am I missing something ?
-
in the code I do use $_post, the $_request was used as follows :
print("<pre>");
$count = count($_REQUEST);
print("Number of values: $count\n");
foreach ($_REQUEST as $key=>$value) {
print(" $key = $value\n");
}
print("</pre></html>\n");
to see what PHP was "seeing" as the variables...I determined how it is behaving by filling in the last line of the form ad seeing that those values survived.
Is there any way to get PHP to behave like .ASP, in that, if the same variable name is used more than once, the $_post will treat the entries as an array ? -
I am convrting a website from .ASP to .PHP and I have run into an isue I cannot resolve. I have a data entry form/table where the variable names are the same in each row. When submitting to a PHP page to write records teh query string is similia to below
http://post.php?parm123=1&parm2=123&parm3=123&parm1=234&parm2=234&parm3=234...
In .ASP, in the receiving page I can extract the following :
parm1 = 123,234,,,,,,
parm2=123,234,,,,,
parm3=123,234,,,,,
and treat them as arrays
in PHP when I go through the $_request, only the last value is available. Is there an extension I need ot a coding trick in PHP to get the query string into an arry, similiar to what .ASP does ??
Thanks in advance for any amd all help.
Indexed $_Request entries
in PHP Coding Help
Posted