Jump to content

Post without a Submit button


markvaughn2006

Recommended Posts

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

 

?>

Link to comment
Share on other sites

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>";

  
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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']

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.