PDA

View Full Version : Submit form using Hyperlink


ccollingsworth
09-17-2005, 08:35 PM
<form name="home" method="post" action="<?php echo $PHP_SELF."?id=".$id; ?>"><input name="act" type="hidden" value="home"></form>
<form name="refer" method="post" action="<?php echo $PHP_SELF."?id=".$id; ?>"><input name="act" type="hidden" value="refer"></form>
<p>What would you like to do?<br>Go to the <a href="#" onClick="">Home Page</a><br><a href="#" onClick="">Become a referrer</a></p>


How do I make the Home Page text to submit the form named "home" and the Become a referrer text to submit the form name "refer"?

Thanks.

coothead
09-18-2005, 02:47 AM
Hi there thekidscareya,

try it like this...

Go to the
<a href="#" onclick="document.home.submit();return false">Home Page</a><br>
<a href="#" onclick="document.refer.submit();return false">Become a referrer</a>
</p>

...or this...

Go to the
<a href="#" onclick="document.forms[0].submit();return false">Home Page</a><br>
<a href="#" onclick="document.forms[1].submit();return false">Become a referrer</a>
</p>