php - In a bit of a while loop mess! -


I have spent a lot of time creating a function and trying to find out the last 15-20 minutes. I need help!

I am selecting several rows from the database and then they are running in the loop.

They are available on a dropdown menu.

  & lt; Form method = "POST" action = "adminprocess.php" & gt; & Lt; Fieldset & gt; & Lt; P & gt; & Lt; Label class = "left2" & gt; League: & lt; / Label & gt; & Lt; Select name = "league" class = "combo" & gt; & Lt ;? Php $ q = $ database- & gt; Selection All League (); While ($ line = mysql_fetch_assoc ($ q)) {$ theid = $ row ['id']; Extract ($ line); ? & Gt; & Lt; Option value = "& lt;? Echo $ theid;; & gt;" & Gt; By & lt;? Counterpart $ format.'_ '. $ Game.'_ '. $ Name.'_ season '. $ Season ;? & Gt; & Lt; / Options & gt; By & lt;? }? & Gt; & Lt; / Select & gt; & Lt; / P & gt; & Lt; P & gt; & Lt; Input type = "hidden" name = "replacement" /> & Lt; Input type = "hidden" name = "format" value = "& lt;? Echo $ format ;? & gt;" / & Gt; & Lt; Input type = "hidden" name = "game" value = "& lt;? Echo $ game ;;>" / & Gt; & Lt; Input type = "hidden" name = "name" value = "& lt;? Echo $ name ;? & gt;" / & Gt; & Lt; Input type = "hidden" name = "weather" value = "& lt;? Echo $ season ;? gt;" / & Gt; & Lt; Input type = 'submit' class = "button" value = 'select league' /> & Lt; / P & gt; & Lt; / Fieldset & gt; & Lt; / Form & gt;  

$ theid is working reliably on the row I selected on the dropdown menu. However, I can not get the values ​​given below in the hidden information in the dropdown box to go through the correct values ​​from the selected values.

It looks like always 4 variables from the first row of the database.

So basically, I need to select the right line and use that data. What am I doing wrong!!! Thanks for reading!

  1. Your hidden areas are initialized outside of the loop, so they 'Will use those values ​​that were saved from the last iteration of the while loop (i.e. the last found row)

  2. you hide in the first place Why are there areas needed? When you submit the form, the ID of the selected row will be in the drop-down box in the league field. While using the ID, you can get other fields from the database while processing the form.


Comments