Button Value outside of the Form is not being posted

19 Views Asked by At

I have this form. The submit button is outside of the form.

<form id="myform" action="" method="post">
    <label>Name</label>
    <input name="name" type="text" value="John Smith">
</form> 
<button type="submit" name="submit_save" for="myform" value="s">Save</button>                

JS detects my Clicking on the button and then I use jQuerty $.post/Ajax to post. (with serialize()) All is almost fine I can see my input value posted, BUT not the value for the submit button itself.

Now if I place the button inside the form, on submit i will have both value posted.

Am I missing something?

0

There are 0 best solutions below