0

I am trying (unsuccessfully) to pass a variable to another php file. I am able to retrieve the information from MySQL, and present it on the web page but I am unable to pass the "hot link" ID to another php file. I am a beginner so it must be something simple but I have tried any number of variations without success. Any help would be appreciated or a pointer in the right direction.

while ($row = mysql_fetch_assoc($result))
{

    echo("<tr>\n<td>" . $row["cityname"] . "</td>"); 
    echo("<td>" . $row["statename"] . "</td>"); 
    echo("<td>" . $row["orgname"] . "</td>");
    echo "<td>";
    echo "<a href = 'graborginfo.php?$varID = {$row['org_id']}'>{$row['org_id']}</td></a>";  

}

Thanks,
Capt Spaghetti

Edited by mike_2000_17: Fixed formatting

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by P0lT10n
0

I am not sure if that worked or not. My graborginfo.php file doesn't display the varID. Of course I may have it wrong as well.

<?php
$varID=$_GET['varID']; 
?>
<html>
<body style="background-color:#33990f">
The selected ID is <?php echo $varID; ?>
</body></html>

Edited by mike_2000_17: Fixed formatting

0

In your first post you wrote

echo "<a href = 'graborginfo.php?$varID = {$row['org_id']}'>{$row['org_id']}</td></a>";

try doing this

echo "<a href='graborginfo.php?varID=".$row['org_id']."'>".$row['org_id']."</td></a>";

This will work.

Edited by mike_2000_17: Fixed formatting

0

Thank you very much for the help. You were absolutley correct. It worked like a charm.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.