Petrus Posted November 18, 2010 Share Posted November 18, 2010 Hi, I know it is probely not a regex question but I don't know the right category. I have 2 variables like $variable1 and $ variable2 which are placed in a loop now I want the $variable to be echo't in a link like <a href="http://exampe.com/$variable1"/> On this dynamicly generated page I want to output the $varible1 of this link and $variable2 while($row = mysql_fetch_assoc($result)) { echo " <tr>"; echo " <td>" . $row["variable1"] . "</td>"; echo " <td>" . $row["variable2"] . "</td>"; echo " </tr>"; Link to comment https://forums.phpfreaks.com/topic/219044-echoing-variable-on-link-page/ Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2010 Share Posted November 18, 2010 You're already halfway there . . . while($row = mysql_fetch_assoc($result)) { echo "<a href=\"http://example.com/{$row['variable1']}\">{$row['variable1']}</a>" } Link to comment https://forums.phpfreaks.com/topic/219044-echoing-variable-on-link-page/#findComment-1135946 Share on other sites More sharing options...
Petrus Posted November 18, 2010 Author Share Posted November 18, 2010 okay I see axilly the variable1 and varialbe2 are the colum names of the table. so now I am getting the url. How do I output on this url within the page both the records of variable1 and variable2 thanks Link to comment https://forums.phpfreaks.com/topic/219044-echoing-variable-on-link-page/#findComment-1135950 Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2010 Share Posted November 18, 2010 It's not really clear what you're trying to do. If you can describe which one needs to go where, I can help you more with this. Link to comment https://forums.phpfreaks.com/topic/219044-echoing-variable-on-link-page/#findComment-1136067 Share on other sites More sharing options...
Petrus Posted November 18, 2010 Author Share Posted November 18, 2010 You're already halfway there . . . while($row = mysql_fetch_assoc($result)) { echo "<a href=\"http://example.com/{$row['variable1']}\">{$row['variable1']}</a>" } this page hase a url <a href=\"http://example.com/{$row['variable1']}\">{$row['variable1']}</a> on this page I want in the <body></body> te output the varibles form the row like variable1 and variable2. so link is clicked <a href=\"http://example.com/{$row['variable1']}\">{$row['variable1']}</a>" which gave a page on that page I want to output variable1 and varible2 I hope you understand now better, please lett me know. Hi, I know it is probely not a regex question but I don't know the right category. I have 2 variables like $variable1 and $ variable2 which are placed in a loop now I want the $variable to be echo't in a link like <a href="http://exampe.com/$variable1"/> On this dynamicly generated page I want to output the $varible1 of this link and $variable2 while($row = mysql_fetch_assoc($result)) { echo " <tr>"; echo " <td>" . $row["variable1"] . "</td>"; echo " <td>" . $row["variable2"] . "</td>"; echo " </tr>"; Link to comment https://forums.phpfreaks.com/topic/219044-echoing-variable-on-link-page/#findComment-1136296 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.