I want to create and submit my form dynamically and have it submit to a page just like a normal form, but when I do this, it puts the values in the query string, not passing them as post values like normally. Why is this?
What am I doing wrong?
//Create the form
var form = document.createElement( "form" );
//Set action (this ends up showing as http://localhost/getform.php?myInput=val
form.action = "getform.php";
//Set the type (I've also tried "application/x-www-form-urlencoded"
form.enctype = "multipart/form-data";
//Add to document
document.body.appendChild( form );
//Create an input, set type, and add to form
var input = document.createElement( "input" );
input.type = "text";
input.name = "myInput";
input.value = "val";
form.appendChild( input );
//Submit the form