View Full Version : Something wrong with while()... help

11-22-2006, 08:55 PM
I have a while code, that picks out rows from my table, and lists them as radio buttons. I then will choose one, and click submit..

while() code:

$result = mysql_query("SELECT * FROM iteminf WHERE anvil='yes' AND name LIKE '%".$ore."%' ", $db);
while($retval = mysql_fetch_array($result)){

echo "<tr><td><input type=\"radio\" name=\"item_name\" value=\"".$retval['name']."\"><input type=\"hidden\" value=\"$ore\" name=\"ore\"><input type=\"hidden\" value=\"".$retval['type']."\" name=\"type\"><input type=\"hidden\" value=\"".$retval['bars']."\" name=\"bars\"></td><td>".$retval['name']."</td> <td align=right>".$retval['bars']."</td></tr><br>";


Post things:

$ore = $_POST['ore'];
$bars = $_POST['bars'];
$item = $_POST['item_name'];
$type = $_POST['type'];

Ok, now when i submit, no matter what i choose, it always returns the same value for $type and $bars... but when they are listed, the bars column says what it should say...

How can i make this work?