daryn
asked on
php dynamic variables from one webpage to another
Hi there.
I've got a problem with php. In one html page, I have a stock entry list where there is an dropdown box to state how many seperate items there are with some code lookin like this:
<?php
for ($indivstockitemscheck=1;$ indivstock itemscheck <=$indivst ockitems;$ indivstock itemscheck ++)
{
?>
<tr>
<td><font face="arial" size="2"><h3>Batch item #<?php echo $indivstockitemscheck; ?></h3></font></td>
</tr>
<tr>
<td><font face=arial size=2><b>Description:</b> </td>
<td><input type="text" size=60 name="itemdesc<?php echo $indivstockitemscheck; ?>"></td>
</tr>
<?php
}
?>
This creates a list of variables like itemdesc1, itemdesc2, itemdesc3 as many itemdesc iterations as the user wishes.
This works fine.
The problem starts when the form is submitted to another php page that has to interpret the _POST variables.
I dont know how to assign variable names to the itemdesc range of variables, ie, this doesnt work:
while ($i<$noofitems)
{
$itemdesc[$i]=$_POST["item desc$i"];
$i++;
}
Anyone got any ideas at all please?
thanks
Daryn
I've got a problem with php. In one html page, I have a stock entry list where there is an dropdown box to state how many seperate items there are with some code lookin like this:
<?php
for ($indivstockitemscheck=1;$
{
?>
<tr>
<td><font face="arial" size="2"><h3>Batch item #<?php echo $indivstockitemscheck; ?></h3></font></td>
</tr>
<tr>
<td><font face=arial size=2><b>Description:</b>
<td><input type="text" size=60 name="itemdesc<?php echo $indivstockitemscheck; ?>"></td>
</tr>
<?php
}
?>
This creates a list of variables like itemdesc1, itemdesc2, itemdesc3 as many itemdesc iterations as the user wishes.
This works fine.
The problem starts when the form is submitted to another php page that has to interpret the _POST variables.
I dont know how to assign variable names to the itemdesc range of variables, ie, this doesnt work:
while ($i<$noofitems)
{
$itemdesc[$i]=$_POST["item
$i++;
}
Anyone got any ideas at all please?
thanks
Daryn
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER