Jump to content

[SOLVED] Making a button look like a hyper link, is it possible?


vdcpaladin

Recommended Posts

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>

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

         <?
   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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.