Re: POST from a hyperlink
by dragonchild (Archbishop) on Apr 25, 2004 at 02:28 UTC
|
The answer involves using JavaScript.
<form action="cgi2.cgi" method="POST" name="thisForm">
<input type="hidden" name="variable2" value="value1" />
<a href=" " onClick="thisForm.submit()">next page</a>
</form>
I'm not fully positive on the exact parameters to the <a> tag. I've only tested this with IE 6. It might not work correctly on other browsers.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
| [reply] [d/l] |
|
|
Thanks for that example. I'll give it a try and throw it through a few different browsers. I appreciate your help. Joe
| [reply] |
Re: POST from a hyperlink
by Anonymous Monk on Apr 25, 2004 at 02:30 UTC
|
You either have to use the submit button, or you have to use javascript. You can use something like the following, but I advise against it. It will break for anyone without javascript... and that can be a lot of people. Best to stick with normal links with GET content... that's what it's there for!
<form action="cgi2.cgi" name="frmGo" method="post">
<input type="hidden" name="variable2" value="value1" />
<a href="javascript:document.frmGo.submit()">
next page
</a>
</form>
| [reply] [d/l] |
|
|
Thanks for you advice. I am also leary about using javascript but I'll reconsider what type of data I send and perhaps use the GET statement as you suggest. Thanks again.
Joe
| [reply] |
|
|
Note that data sent via POST is no more secure than data sent via GET. It's still data that's visible from the client-side. If you have data you need to keep secure, the best way is to not send it to the client at all. You will need sessions and a lot more infrastructure that's beyond the scope of my Sunday morning reply. :-)
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
| [reply] |
|
|
Re: POST from a hyperlink
by TwistedGreen (Sexton) on Apr 25, 2004 at 18:22 UTC
|
You should know that you can also use CSS to change your submit button to look like whatever you want: change its colours or borders, or replace it with another image entirely. | [reply] |
|
|
<input type="image" src="/whatever.gif"> will also work and doesn't require CSS (not that CSS is a bad thing, just that an image input is simpler).
| [reply] [d/l] |
|
|
| [reply] |
|
|
A reply falls below the community's threshold of quality. You may see it by logging in.
|
|
|
It might be simpler, but maybe I'm using a terrible old and slow modem and on top of that, it takes too many hops to reach your server. In that case, I can switch off CSS and get the default submit button, instead of downloading your whatever.gif, what should be a whatever.jpeg or whatever.png to begin with ;-)
And another nice advantage of the CSS approach is that maybe in a month time you like to restyle your website and you have a new whatever image. The bad thing is that you were cheap and chose a webhosting company that only allows you to use FTP (yeah, they are out there ;-) Now you need to download all the files that contain the reference to this image, change them and upload them again. With the CSS approach, you simple alter the CSS file and upload that one.
--
b10m
All code is usually tested, but rarely trusted.
| [reply] |
|
|
|
|
That's a good shortcut. Seems easy to implement. Thanks for the tip. Joe
| [reply] |
|
|
Neat! You learn someting new every day. That would certainly solve my form uglieness problem. Thanks for the info. Joe
| [reply] |