I want to add an input to a form and cannot make it work. When loading the page, clicking "submit" and looping through the $_POST array, no input was added to the form.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
$('#myOrder').append('<input type="text" name="test" value="product">');
</script>
<form id="myOrder" action="" method="post">
<input type="submit" value="Submit">
</form>
<?php
if ($_POST)
{
foreach($_POST as $key => $value)
{
echo $key . "<br>";
echo $value;
}
}
?>
</body>
</html>
Help is highly appriciated!