> i have got me a form, that when submitted is effectlively only one > variable, > but when i submit it, it grabs the last field displayed instead of the one > selected.. normally this would be easy but I think because I have it > inside > a loop it's playing havock on me.. > > > -----[form code in side the while loop] ----- > // print all records in the DB > while ($myrow = mysql_fetch_array($res)): > $count++;?> > <tr><td><div align='center'> > <font class="content"><?//=$myrow['id'] > echo $count;?></font> > </div></td><td> </td><td> > <div align='justify'><font class="content"> > <?=$myrow['uname']?></font></div></td><td><font > class="content"><?=$myrow['firstname']?></font></td> > <td><font class="content"><?=$myrow['lastname']?></font></td><td><font > class="content"><?=$myrow['company']?></font></td> > <td><font class="content"><input type="hidden" name="number" > value="<?=$myrow['id']?>"><input type="submit" name="usubmit" > value="send">// pass on $myrow['id'] to next page > </font></td></tr> > <? endwhile; ?> > -------------------------------------------
Okay, so you've got a bunch of hidden elements all with the same name and a bunch of submit buttons with the same name. Which "number" do you expect the "submit" button you choose to send? It's only going to choose the last one, since that was the last "number" that was given a value. The easy way to do this would be to just send the value you're after as the value of your submit button. <input type="submit" name="number" value="<?=$myrow['id']>"> Or, you could put form tags within your code above, so each hidden element and submit button is it's own form. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php