Jump to content

Archived

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

OriginalSunny

How to make a submit button a link

Recommended Posts

Hi,
instead of having the standard link (blue text underlined) i want to make a link to another page using a submit button. The code i have used for the button is below.

[i]echo "<tr>
<td colspan='2'> <input type='submit'
value='Return to orders menu'></td>\n";[/i]

As you can see this will not actually do anything except display the button. The question is how do i make this into a link? (I have used this code on my [i].php[/i] page and am not reading anything in from a [i].ini[/i] page and hopefully wont have to unless i need to).
Thanks.

Share this post


Link to post
Share on other sites
You have to put it inside a form and set the 'action' attribute of the form to the url you want. BUT WHY????

all that hassel just for a link and you aren't even sending any data! I'd just use an image for the link if you don't want the 'plain' text or better still use css well and create a funky link! Latter is much better for accessibility!

Share this post


Link to post
Share on other sites
You can simply say
<button onclick="self.location.href='your url'" type="button">Button Text</button> but what happens when there's no javascript?

Share this post


Link to post
Share on other sites
I would suggest using images for the simple fact that some people turn javascript off in their browser and using a form for each link in your site just leads to lots of superfluous code. Then of course the obvious question is, do you have any idea of the capability of CSS in this matter? You do know that the text does not have to be underlined or blue, right? You can even make the background behind it change colors.

Share this post


Link to post
Share on other sites

×

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.