Whats gone wrong here?
I can use the code above to generate new rows in a table, by using the add text link. Information from the database is put into drop down menus. The links in the menus are used to create a ?item= URL link on the page.PHP Code:<?PHP //URL array organised
$lookatURL = $_GET["item"];
$URLarray = explode(":",$lookatURL);
$URLnumber = count($URLarray);
?>
<table width="100%" border="1" cellspacing="2" cellpadding="0">
<tr>
<td width="10%" align="center" valign="top">Item</td>
<td width="80%" align="center" valign="top">
Description</td>
<td width="10%" align="center" valign="top">Total</td>
</tr>
<?PHP
$boxRows = 0;
while ($boxRows < $URLarray[1]){
?><tr>
<td width="10%"><form name="form1" id="form1">
<select name="item" onchange="MM_jumpMenu('parent',this,0)">
<option>Select</option><?PHP
$trees = (mysql_query("SELECT * FROM database"));
while($row = mysql_fetch_array($trees)){
?><option value="?item=<?PHP
$numbered = 0;
while ($numbered < $URLnumber )
{
$bx = ($boxRows + 2);
$URLarray[$bx] = $row[3];
echo "$URLarray[$numbered]:";
$numbered++;
}
?>"><?PHP echo "$row[3]"; ?></option>
<?PHP } ?>
</select>
</form></td>
<td width="80%"></td>
<td width="10%"></td>
</tr>
<?PHP
$boxRows++;
} ?>
<tr>
<td><a href="?item=<?PHP
$boxNumber = ($URLarray[1]+1);
$URLarray[1] = $boxNumber;
$numbered = 0;
while ($numbered < $URLnumber )
{
echo "$URLarray[$numbered]:";
$numbered++;
}
?>" class="style4">add</a></td>
<td class="style2"><span class="style4"></span></td>
<td></td>
</tr>
</table>
<?PHP
mysql_close($con);
?>
Each link has been seporated to fill the information in along different parts of the URL.
When selecting choices from the bottom and moving up the generated rows every thing in the URL displays as expected. But if done in reverse selecting from the top and moving down the choices, everything changes to the last row in the database.
Any additions to this code to solve this problem?
Thanks.




Reply With Quote