howdy

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>&nbsp;</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; ?>
-------------------------------------------

----------[processing code of the form]------
function usubmit(){
$id = $_POST['number'];
$res=mysql_query("SELECT * from users WHERE id='$id'");
$num = mysql_numrows($res) or die ( Header("Location:
logerror.php?op=log_error") );
$email = mysql_result($res, 0, 'email');
$passwd = mysql_result($res, 0, 'passwd');
$uname = mysql_result($res, 0, 'uname');
$fname = mysql_result($res, 0, 'firstname');
if(!$boo){
echo mysql_error();
} else {
//test output of values
echo $id; // show's id to be the last id in the DB
echo "<br>";
echo $email;
echo "<br>";
echo $uname;
echo "<br>";
echo $passwd;
echo "<br>";
echo $fname;
echo "<br>";
}
-----------------------


Cheers

Peter
"the only dumb question is the one that wasn't asked"



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to