zed420 Posted April 21, 2008 Share Posted April 21, 2008 Hi All I wonder if you can help me. I'm trying to make the table results as a link to a different page but I can't make head or tail of it. Here's my code, I 'm trying to make [itemDes] as a link to a different page, how do I do it ???? function ItemDisplay (){ $query = "SELECT * FROM itemtb ORDER BY id"; $result = mysql_query($query) or die ("Couldn't execute query for collecting your data."); while ($row = mysql_fetch_array($result)) { extract($row); echo ("<tr align=center>\n"); $a = $ItemType.$id; echo "<td>$a</td>"; echo "<td align=center>$row[itemName]</td>\n"; echo "<td align=center>$row[itemDes]</td>\n"; echo "<td align=center>$row[itemPrice]</td>\n"; echo "<td align=center>$row[date]</td>"; echo "</tr>"; } echo "</table>\n"; echo "</form><br>\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/ Share on other sites More sharing options...
sasa Posted April 21, 2008 Share Posted April 21, 2008 change echo "<td align=center>$row[itemDes]</td>\n"; to echo "<td align=center><a href='link_to_diferent_page'>$row[itemDes]</a></td>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522900 Share on other sites More sharing options...
dezkit Posted April 21, 2008 Share Posted April 21, 2008 Why does it say echo "</form> at the end? Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522909 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 to make the code look nicer and just a helpfull tip, you can have the whole form in one echo instead of seperate lines Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522918 Share on other sites More sharing options...
zed420 Posted April 21, 2008 Author Share Posted April 21, 2008 to make the code look nicer and just a helpfull tip, you can have the whole form in one echo instead of seperate lines Thanks blue much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522928 Share on other sites More sharing options...
zed420 Posted April 21, 2008 Author Share Posted April 21, 2008 change echo "<td align=center>$row[itemDes]</td>\n"; to echo "<td align=center><a href='link_to_diferent_page'>$row[itemDes]</a></td>\n"; It works, Thanks mate I really thought It'll be much complex than this. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522932 Share on other sites More sharing options...
zed420 Posted April 21, 2008 Author Share Posted April 21, 2008 Why does it say echo "</form> at the end? It's a mistake, thanks for point it out. Quote Link to comment https://forums.phpfreaks.com/topic/102158-how-to-create-a-link/#findComment-522933 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.