Can someone tell me why on earth this is not submitting to self?
I have the following setup:
<?php
print_r($_POST);
?>
<form name="bizLoginForm" method="post" action"" >
<table id="loginTable">
<tr><td>Username:</td><td><input type="text" id="loginUsername" /></td></tr>
<tr><td>Password:</td><td><input type="password" id="loginPassword" /></td></tr>
</table>
<input type="Submit" value="Login" />
</form>
and every time I click on the submit button i see nothing inside the POST array. What simple thing have I totally overlooked?
Thanks!
The <input type="submit"> defines a button for submitting the form data to a form-handler. The form-handler is typically a file on the server with a script for processing input data. The form-handler is specified in the form's action attribute.
<br> <input type="submit" name="submit" value="Submit"> </form>
The proper way would be to use $_SERVER["PHP_SELF"] (in conjunction with htmlspecialchars to avoid possible exploits). You can also just skip the action= part empty, which is not W3C valid, but currently works in most (all?) browsers - the default is to submit to self if it's empty.
Submit a Form Using JavaScript The most simple way to submit a form without the submit button is to trigger the submit event of a form using JavaScript. In the below example we are going to create a function to submit a form. We will set that function at onclick event of a div tag.
Aside from the fact the equals is missing from your action
attribute in your form element.
Your inputs need name attributes:
<tr>
<td>Username:</td>
<td><input id="loginUsername" name="loginUsername" type="text" /></td>
</tr>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With