MDanz Posted August 23, 2009 Share Posted August 23, 2009 I have a search engine.. when the results come... i want to post the $name variable from the result to reply.php this is how i show results echo '<table '.$margin.'>'; while ($runrows = mysql_fetch_assoc($run)){ $id = $runrows['id']; $name = $runrows['name']; $image = $runrows['image']; $hyperlink = $runrows['hyperlink']; $currency = $runrows['currency']; $info = $runrows['info']; $type = $runrows['type']; $rating = $runrows['rating']; $keywords = $runrows['keywords']; echo '<td><tr>'; echo "<a href='$hyperlink'><img src='http://www.u-stack.com/Stack.jpg'></a>"; echo "</tr><font color=white><strong> $name - $info - $rating <a href='rate.php?id=$id'><img src='http://www.u-stack.com/rate.jpg'></a></font> <a href='http://www.u-stack.com/reply.php?reply=$name&submit=reply' style='text-decoration: none'; >Reply</a> </center><br><br><hr size='1'></strong></td>"; } echo '</table>'; i want to post the $name variable to reply.php so in the reply.php textfield, i can set the value as $name and the name of the result appears in the textfield. Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/ Share on other sites More sharing options...
Catfish Posted August 23, 2009 Share Posted August 23, 2009 try: print($_GET['name']); in reply.php Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/#findComment-904414 Share on other sites More sharing options...
MDanz Posted August 23, 2009 Author Share Posted August 23, 2009 didnt work... Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/#findComment-904415 Share on other sites More sharing options...
Catfish Posted August 23, 2009 Share Posted August 23, 2009 if you are going to reply.php?name=something and you print($_GET['name']); it should print "something" on the page (the value of 'name') if you want it to be placed in the textarea in reply.php, you must print($_GET['name']); between the <textarea></textarea> tags like: <textarea> print($_GET['name']); </textarea> if it is not outputting the value of 'name', then the value of 'name' is not being passed to reply.php in the first place. Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/#findComment-904420 Share on other sites More sharing options...
MDanz Posted August 23, 2009 Author Share Posted August 23, 2009 hi thx for help.. returned the value '1' for some reason on search.php this is how i use $name & reply.php... <a href='http://www.example.com/reply.php?reply=$name&submit=reply'>Reply</a> so the reply is associated with the name of the result from the search. all the results have different names, so when a user replies, it uses the name(result) like a thread title. and in reply.php this is the text field i want the $name value in. I tried it this way originally then your way. <input type='text' name='keywords' value='$name' <br> Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/#findComment-904432 Share on other sites More sharing options...
Catfish Posted August 23, 2009 Share Posted August 23, 2009 when you hover the mouse over the link that is generated by the first page, does it have "name=something" in the URL? where "something" is a different value for each link? it sounds like the $name variable is not being passed correctly to reply.php Link to comment https://forums.phpfreaks.com/topic/171507-posting-a-variable-to-another-page/#findComment-904604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.