Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit form with href link problem

Status
Not open for further replies.

dessie1981

Programmer
Joined
May 9, 2006
Messages
116
Location
GB
Hi Everyone,

Im new to javascript and i am having a problem submiting my form using a link.

Here's my code

<html>
<head>
<title>
form test
</title>
</head>
<body>
<script type="text/javascript">
<!--
function formSubmit()
{
document.myform.submit();
}
//-->
</script>
<form name="myform" method="post" action="formtest2.php">
<input type="text" name="purchaseid">
</form>
<!-- "navigate" to somewhere -->
<p>
<A HREF="formtest2.php" onclick="formSubmit()">confirm & navigate to somewhere else</A>
</p>

</body>
</html>

On trying to recieve the parameter i get the Notice : Undefined index: purchaseid



Can anyone help?
 
Looks like a problem retrieving the info, not submitting the form ...

Are you sure this is a javascript and not a php question?

Cheers,
Dian
 
Well in not so sure as im returning the parameter as usual in php, also if i add in target ="_blank" the parameter is returned ok in the same window , however a new windo opens in the browser with the undefined index notice.

Strange.
 
Found solution
used and it works now.
<a href=# onclick="formSubmit(); return false;">Submit</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top