MDanz Posted August 30, 2009 Share Posted August 30, 2009 this is just part of my code while ($runrows = mysql_fetch_assoc($run)){ $id = $runrows['id']; $name = $runrows['name']; $hyperlink = $runrows['hyperlink']; [b] $info = $runrows['info'];[/b] $rating = $runrows['rating']; $keywords = $runrows['keywords']; echo "[b]<a href="">[/b]<img src='http://www.nbfsasfdf.com/Stacks/Strip.jpg'></a>"; i want on the click of the image, the hyperlink takes me to the page(info.php already made) displaying the contents of the variable $info.. how do i do this? Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/ Share on other sites More sharing options...
ignace Posted August 30, 2009 Share Posted August 30, 2009 <a href="info.php?data=<?php print base64_encode($info); ?>"> On info.php print base64_decode($_GET['data']); Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909328 Share on other sites More sharing options...
MDanz Posted August 30, 2009 Author Share Posted August 30, 2009 hi i'm getting weird symbols on the page? for example ¦i®)ím«ë‡§r‡^5«b¢v¥«$zÖÚ–P,²‡"jب Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909337 Share on other sites More sharing options...
ignace Posted August 30, 2009 Share Posted August 30, 2009 <a href="info.php?data=<?php print urlencode(base64_encode($info)); ?>"> You could ofcourse instead of passing $info also pass the id, like: <a href="info.php?id=<?php print $id; ?>"> Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909340 Share on other sites More sharing options...
MDanz Posted August 30, 2009 Author Share Posted August 30, 2009 i'm getting this error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/ustackc1/public_html/index.php on line 179 echo "<a href="info.php?data=<?php print urlencode(base64_encode($info)); ?>"><img src='http://www.gsgsgdk.com/Stacks/Strip.jpg'></a>"; <?php print base64_decode($_GET['data']); ?> Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909342 Share on other sites More sharing options...
MDanz Posted August 31, 2009 Author Share Posted August 31, 2009 ok i've changed it to this.. <a href='http://www.u-stack.com/info.php?info=$id'> and in info.php <?php $id = $_GET['id']; $info = $_GET['info']; echo $info; ?> but its not working.. Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909499 Share on other sites More sharing options...
Batosi Posted August 31, 2009 Share Posted August 31, 2009 Ok when you use $id in the url you then have to get the information with a query in info.php <?php $id = $_GET['id']; $id = mysql_real_escape_string($id); ## always do this!!!! $result = mysql_fetch_assoc(mysql_query("SELECT * FROM `table` WHERE `id` = '$id'")); echo $result['info']; ?> Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909503 Share on other sites More sharing options...
MDanz Posted August 31, 2009 Author Share Posted August 31, 2009 for some reason on info.php i get a blank page <a href='http://www.fsddf.com/info.php?id=$id' style='text-decoration: none';> info.php <?php mysql_connect("localhost", "Master", "password"); mysql_select_db("db"); $id = $_GET['id']; $id = mysql_real_escape_string($id); $result = mysql_fetch_assoc(mysql_query("SELECT * FROM `Stacks` WHERE `id` = '$id'")); echo $result['info']; ?> ?? any idea Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909514 Share on other sites More sharing options...
ignace Posted August 31, 2009 Share Posted August 31, 2009 Do you print it like this? echo "<a href='http://www.fsddf.com/info.php?id=$id' style='text-decoration: none'>"; What does the url say when click on this link? does id have a value in the url? Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909559 Share on other sites More sharing options...
MDanz Posted August 31, 2009 Author Share Posted August 31, 2009 http://www.fdsdf.com/info.php?id=1 ^^ thats how it looks.. it should work i dunno why? Link to comment https://forums.phpfreaks.com/topic/172482-help-posting-variable-to-page/#findComment-909573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.