Jump to content

[SOLVED] how to send variable through link


phplearner2008

Recommended Posts

<?php

while($row = mysql_fetch_array($result))

{

 

$id = $row['name'];

}

?>

<a href="http://localhost/mypage.php?id=$id">Mypage</a>

 

 

In mypage.php,

 

$myid = $_GET['id'];

echo "$myid";

 

This is the code I am trying to execute. Any suggestions?

Thank you ranjuvs, I made a small change to your code and it worked!

 

Instead of <a href = "http://localhost/mypage.php?id="<?php print $id ?>>MyPage</a>

I put ending quotes at end of php like this

 

<a href = "http://localhost/mypage.php?id=<?php print $id ?>">MyPage</a>

 

My problem is solved

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.