OriginalSunny Posted March 27, 2006 Share Posted March 27, 2006 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. Link to comment https://forums.phpfreaks.com/topic/5960-how-to-make-a-submit-button-a-link/ Share on other sites More sharing options...
ToonMariner Posted March 27, 2006 Share Posted March 27, 2006 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! Link to comment https://forums.phpfreaks.com/topic/5960-how-to-make-a-submit-button-a-link/#findComment-21354 Share on other sites More sharing options...
azuka Posted March 28, 2006 Share Posted March 28, 2006 You can simply say<button onclick="self.location.href='your url'" type="button">Button Text</button> but what happens when there's no javascript? Link to comment https://forums.phpfreaks.com/topic/5960-how-to-make-a-submit-button-a-link/#findComment-21388 Share on other sites More sharing options...
txmedic03 Posted March 28, 2006 Share Posted March 28, 2006 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. Link to comment https://forums.phpfreaks.com/topic/5960-how-to-make-a-submit-button-a-link/#findComment-21440 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.