I can’t explain why this was so difficult, but it kicked my butt for weeks. I needed to create a simple form and then submit to a new page.
This is the simple form:
This is the snippet
// code for the form
$form_html = '
<style type="text/css">
<!--
.label { font-size: 100%;
font-size: large;
font-family: Arial, Helvetica, sans-serif;
text-decoration: underline;
}
.content { margin-left: 60px;
font-size: x-large;
font-family: Arial, Helvetica, sans-serif;
}
.button {font-size: x-large;
font-family: Arial, Helvetica, sans-serif;
position: relative;
left: 50%;
transform: translateX(-50%);
}
-->
</style>
<form method="post" action="/wordpress-form-receive/" >
<p class="label">First Name:</p>
<input type="text" name="firstname" value="Mickey"><br>
<p class="label">Last Name:</p>
<input type="text" name="lastname" value="Mouse"><br><br>
<input type="submit" class="button" value="Submit">
</form> ';
//MOST IMPORTANT PIECE
echo $form_html;
One thought on “WordPress Form Submit (POST)”
Comments are closed.