Submit post data via link?

liunx

Guest
I've developed an auto dealer site, but found that one of the links does not properly access the database of used cars. To make a long story short, I need to make a link to send post variables (NOT get variables) to a php script, without using images or submit buttons; only with a text-based link. Could that be done with HTML, or maybe, JavaScript?<!--content-->Let me dig up the code real quick...give me about two minutes...:D<br />
<br />
EDIT:<br />
<form method=POST ACTION="where you want info submitted to"><br />
<td colspan="2"><br />
<input type="text" size="10" name="name of this variable" value"what appears in box of variable(may be left blank)"><br />
</td><br />
<br><br />
<br />
<td colspan="2"><br />
<input type="password" size="10" name="password" value="">(if no password needed you may remove this section)<br />
<tr><td></td><br><td align=left valign=top><br />
<input type=submit name=submit value=""><br />
</form><!--content-->would it not be easier to submit the form on clicking a link, or just use css to make it look as if the button was indeed a link?<!--content-->I mis-understood your question....LOL!...I don't know about that one...maybe there is a way to use what I posted to achieve this?<!--content-->And I liked dave....he was cool....*says good-bye to him*...when did he leave?...o.O<!--content-->I'll assume your form is set to post and it's name is myForm.<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="document.myForm.submit();return false;">Click to submit</a><!--content-->I'll assume your form is set to post and it's name is myForm. <br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="document.myForm.submit();return false;">Click to submit</a><br />
<br />
<br />
Ah, that's exactly what I was looking for. I knew there was a JavaScript function for that, but I forgot which it was, and I couldn't find it on google. I'm surprised by the prompt replies! :D<!--content-->i guess to be compatible with other browsers, you might want to use:document.forms['myForm'].submit()<!--content-->Also remember that not everybody has JavaScript enabled, so be sure to remember them:<br />
<br />
<form action="yourpage.php" method="post" name="frm"><br />
<div><input type="hidden" name="foo" value="bar" /><br />
<script type="text/javascript"><br />
//<![CDATA[<br />
document.write('<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onclick="document.forms[\'frm\'].submit(); return false;">submit</a>');<br />
//]]><br />
</script><br />
<noscript><br />
<input type="submit" name="submit" value="submit" /><br />
</noscript></div><br />
</form><!--content-->
 
Back
Top