Saturday, November 27, 2004

How do I use a hyperlink to POST form variable?

How do I use a hyperlink to POST form variable?

<form name="aform" action="somewhere.php" method="post">

<input type="hidden" name="firstName" value=" <?php echo $firstName ; ?> ">

<input type="hidden" name="lastName" value=" <?php echo $lastName ; ?> ">

<input type="hidden" name="section" value="0">

</form>


Simply add a little JavaScript somewhere in the <head> ... </head> part of your page and we're done. The JavaScript would look something like this...



function clickpost(param)

{

document.forms.aform.elements .section.value = param;

document.forms.aform.submit;

return true;

}

No comments: