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

Member Avatar for P0lT10n

dont put graborginfo.php?$varID do graborginfo.php?varID

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>
Member Avatar for P0lT10n

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.

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

Member Avatar for P0lT10n

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.