Forum Moderators: coopster

Message Too Old, No Replies

Select Col value used as link,pass value to new form

Newbie - Please help!

         

kpage

12:23 pm on Feb 1, 2005 (gmt 0)

10+ Year Member



I am displaying a list of values from a mysql backend, making one of the returned columns a link. I want the user to click the link(returned value) and then I want php to use this value illustrated by the link to return another resultset from mysql. Code opens the new page fine, but is not capturing or passing the value to the new page. I have been googling, reading and trying new bits of code for days, but still nothing works. Any help would be much appreciated!

Here is code:

while ($row= mysql_fetch_array($rs))

{

$list.="<tr>";

$list.="<td><a href=namesearch3.php $meta=mysql_fetch_field($rs)>".$row["hospnum"]."</a></td>";
$list.="<td>".$row["fstname"]."</td>";
$list.="<td>".$row["surname"]."</td>";
$list.="<td>".$row["dob"]."</td>";

$list.= "</tr>";

}

echo($meta);
$list.="</table>";
echo(<INPUT TYPE="hidden" onClick="this.form.submit('newsearch3.php<?php echo($meta=mysql_fetch_field($rs);?>')" name="submit">

echo($list);

?>

Zipper

1:48 pm on Feb 1, 2005 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld kpage!

first of all you've scrambled up your php tags. secondly, you're trying to define a variable inside another one. never mind. anyway, what's your intention in using mysql_fetch_field($rs)? isn't it the same field you're getting throughout the loop? why not directly use the field name instead..

take a look at this..


while ($row = mysql_fetch_array($rs))
{
$list.="<tr>";
$list.="<td><a href=namesearch3.php?[b]hospnum[/b]=".$row["hospnum"].">".$row["hospnum"]."</a></td>";
$list.="<td>".$row["fstname"]."</td>";
$list.="<td>".$row["surname"]."</td>";
$list.="<td>".$row["dob"]."</td>";
$list.= "</tr>";
}
$list.="</table>";
echo "<INPUT TYPE=\"hidden\" onClick=\"this.form.submit('newsearch3.php?hospnum=')\" name=\"submit\">";
echo$list;

if its not what u wanted to do, let us know more details about your recordset, so we can get a clear picture.

kpage

3:01 pm on Feb 1, 2005 (gmt 0)

10+ Year Member



Thanks so much for your help!

Zipper

3:18 pm on Feb 1, 2005 (gmt 0)

10+ Year Member



no problem..