markvaughn2006 Posted January 26, 2010 Share Posted January 26, 2010 I'm making a custom forum, the below code displays all of a user's favorite boards with a submit button next to it to take them to that board. How could i get rid of the submit button and make the board title be clickable and post the value $rowfav['board']?? thanks in advance!! <?php $resultfav = mysql_query("SELECT * FROM favorites WHERE owner='$username'") or die(mysql_error()); while ($rowfav = mysql_fetch_array($resultfav)) { echo '<form target="_self" method="post" action="board.php"><input type="submit" value="Go" />'." - ".ShortenText($rowfav['board']).'<input type="hidden" name="equip" value="'.$rowfav['item_name'].'" /></form>'; } So ideally, it would display all the board titles and when you click the title, it will take them to board.php which will display info about the board and will know what board it is through posting the board title ?> Quote Link to comment Share on other sites More sharing options...
Skipjackrick Posted January 26, 2010 Share Posted January 26, 2010 I think you are trying to do this? <?php $resultfav = mysql_query("SELECT * FROM favorites WHERE owner='$username' "); $result = mysql_query($resultfav) or die(mysql_error()); echo "<a href='{$result['item_name']}' >{$result['board']}</a>"; ?> Quote Link to comment Share on other sites More sharing options...
markvaughn2006 Posted January 26, 2010 Author Share Posted January 26, 2010 whoops... here is the code <?php $resultfav = mysql_query("SELECT * FROM favorites WHERE owner='$username'") or die(mysql_error()); while ($rowfav = mysql_fetch_array($resultfav)) { echo '<form target="_self" method="post" action="board.php"><input type="submit" value="Go" />'." - ".ShortenText($rowfav['board']).'<input type="hidden" name="boardtitle" value="'.$rowfav['board'].'" /></form>'; } ?> What I'm trying to do is make it like if you click on my name on phpfreaks it will take you to my profile, so.. you click on the board title on my site and it will take you to that board, but there is no url to take you directly there so it will have to go to board.php and use the posted board title to select * from that board and display it. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted January 26, 2010 Share Posted January 26, 2010 you can use $_GET variables for that. you can simply make a link like so <a href="where.php?id=5&name=mike">Clicky</a> in where.php you can access those values in the $_GET array. for example, the value of 5 (sent in the variable "id") can be accessed via $_GEt['id'] Quote Link to comment Share on other sites More sharing options...
markvaughn2006 Posted January 26, 2010 Author Share Posted January 26, 2010 aha!...thats putting me on the right path! Resolved...for now. 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.