vdcpaladin Posted April 22, 2008 Share Posted April 22, 2008 Hey guys im working on trying to make a submit button work as normal but appear like a hyperlink ie(blue with underline) so that the user clicks the link insted of clicking a button. Here is my current code. I have been using a selection radio button with a form submit button at the bottom to allow the user to select a job and then view the details. Basically I want the radio button code to be replaced with something to work as the submit code does but look like a hyperlink insted of a button <form action="viewlisting.php" method="POST"> <? $db->close(); ?> <tr> <td colspan=2><table border = 1 height="80%" width="80%" align="center" bgcolor="#FFFFFF"> <tr> <td height="31" class="content"><b>Category Description</b></td> <td class="content"><b>Listing title</b></td> <td class="content"><b>Description</b></td> <td class="content"><b>Select</b></td> </tr> <? while($item2 = mysql_fetch_row($result2)) { echo "<td>"; print_r($item2[1]); echo "</td><td>"; print_r($item2[6]); echo "</td><td>"; print_r($item2[5]); echo "</td><td>"; echo "<input type = 'radio' name = 'selection' value='"; echo $item2[3]; echo "'>"; echo "</tr>"; } ?> </table> <p align="center"> <input type="submit" value = "View Job Details" onClick = "form.action = 'viewlisting.php'"> </p></td> </tr> </form> Quote Link to comment Share on other sites More sharing options...
BrianM Posted April 22, 2008 Share Posted April 22, 2008 That's to easy. <a href="location" onclick="submit()">text</a> Quote Link to comment Share on other sites More sharing options...
vdcpaladin Posted April 22, 2008 Author Share Posted April 22, 2008 Thanks for that but it still doesnt answer the whole question. Im removing the radio button completely but i still need to assign each href when clicked with a selection so that the viewListing page actually looks up the correct job from the database Quote Link to comment Share on other sites More sharing options...
vdcpaladin Posted April 22, 2008 Author Share Posted April 22, 2008 <? while($item2 = mysql_fetch_row($result2)) { echo "<tr>"; echo "<td>"; echo "<input type = 'hidden' name = 'selection' value ='>"; echo $item2[3]; echo "'>"; echo "<a href='viewlisting.php' onclick='submit()'>"; print_r($item2[6]); echo "</td></tr><tr><td>"; print_r($item2[5]); echo "</td>"; echo "</tr>"; } ?> this is what i have now but it is not sending the selection to the other page Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 Do you have the whole: <form action="viewlisting.php" action="POST"> line? Quote Link to comment Share on other sites More sharing options...
vdcpaladin Posted April 22, 2008 Author Share Posted April 22, 2008 Yeah i do sorry i should have added more code Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 22, 2008 Share Posted April 22, 2008 Change this: echo "<input type = 'hidden' name = 'selection' value ='>"; echo $item2[3]; echo "'>"; echo "<a href='viewlisting.php' onclick='submit()'>"; to this: echo "<a href='viewlisting.php?selection=". $item2[3]. "'>view</a>"; When the view link is clicked, the value of the selection is passed to viewlisting.php. In viewlisting.php, retrieve the value of $_GET['selection'] to find what was passed. No form tags necessary. 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.