Why code below don't include "?PackageID=1" when clicked

stndn

Golden Member
Mar 10, 2001
1,886
0
0
If you want to include that as a parameter for processing, place it as hidden field instead of submit's onclick()

Also, i'm assuming you're submitting the form using GET method since you have the parameters with '?' as delimiter?

<form method='get' action='ProductionMain.php' id='packages'>
<input type='hidden' name='PackageID' value='1' />

<!-- blah blah blah -->

<input type='submit' name='submit' value='View Details' />
</form>


Edit: wrong form attributes
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Because the onclick attribute isn't supposed to be a url, it's supposed to be a javascript event handler. You can put the parameter in a hidden field as stndn said, or you can put the full url in the action attribute of the <form> tag:

<form method="PUT/GET" action="ProductionMain.php?PackageID=1">
...
</form>

If you insist on doing it from the <input> tag (like maybe you want different buttons to submit to different places) you can do this:

<input type="submit" onclick="this.form.action='ProductionsMain.php?PackageID=1'" value="View Details">