phplearner2008 Posted September 29, 2008 Share Posted September 29, 2008 Hi, I have a variable $id which i would like to send to mypage.php. Can anyone tell me how to do it? <a href = "http://localhost/mypage.php?id=$id">MyPage</a> doesn't seem to work. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted September 29, 2008 Share Posted September 29, 2008 how are you retreving it at mypage.php it should be like this $id = $_GET['id']; echo $id; Scott. Quote Link to comment Share on other sites More sharing options...
phplearner2008 Posted September 29, 2008 Author Share Posted September 29, 2008 <?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? Quote Link to comment Share on other sites More sharing options...
ranjuvs Posted September 29, 2008 Share Posted September 29, 2008 Try this <a href = "http://localhost/mypage.php?id="<?php print $id ?>>MyPage</a> Quote Link to comment Share on other sites More sharing options...
phplearner2008 Posted September 29, 2008 Author Share Posted September 29, 2008 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.