Reputation: 1744
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!
Upvotes: 8
Views: 54310
Reputation: 14535
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>
Upvotes: 12
Reputation: 1
try this
<?php
if(isset($_GET["submitted"])){
print_r($_POST["values"]);
} else {
?>
<form name="bizLoginForm" method="post" action="?submitted" >
<table id="loginTable">
<tr><td>Username:</td><td><input type="text" name="values[]" id="loginUsername" /></td></tr>
<tr><td>Password:</td><td><input type="password" name="values[]" id="loginPassword" /></td></tr>
</table>
<input type="Submit" value="Login" />
</form>
<?php
}
?>
Upvotes: 0
Reputation: 416
Try this
<?php
if(isset($_POST['submit_button']))
print_r($_POST);
?>
<form name="bizLoginForm" method="post" action"<?php echo $_SERVER['PHP_SELF']?>" >
<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" name="submit_button" value="Login" />
</form>
Save the file with .php extension
Upvotes: 2
Reputation: 2837
<form name="bizLoginForm" method="post" action"" >
should be
<form name="bizLoginForm" method="post" action="" >
Missing = sign.
You're also missing the name attribute inside your input tags, so change
<input type="text" id="loginUsername" />
and
<input type="password" id="loginPassword" />
to
<input type="text" id="loginUsername" name="loginUsername" />
and
<input type="password" id="loginPassword" name="loginPassword" />
Upvotes: 8
Reputation: 2383
<?php
print_r($_POST);
?>
<form name="bizLoginForm" method="post" action="" >
<table id="loginTable">
<tr><td>Username:</td><td><input type="text" name="login" id="loginUsername" /></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" id="loginPassword" /></td></tr>
</table>
<input type="Submit" value="Login" /></form>
Upvotes: 4