2012-08-17 18 views
5

Kann mir jemand sagen, warum auf der Erde das nicht sich selbst unterwirft?HTML Form Submit To

Ich habe folgendes 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> 

und jedes Mal, wenn ich auf die Schaltfläche i nichts innerhalb des Array POST sehen einreichen klicken. Was für eine einfache Sache habe ich völlig übersehen?

Danke!

Antwort

8

aus der Tatsache Neben dem Gleichheits von Ihrem action Attribute in Ihrem Formularelement fehlt.

Ihre Eingaben müssen Name Attribute:

<tr> 
    <td>Username:</td> 
    <td><input id="loginUsername" name="loginUsername" type="text" /></td> 
</tr> 
+0

Das ist die richtige Antwort. –

+0

ah ha! Vielen Dank!! – ackerchez

8
<form name="bizLoginForm" method="post" action"" > 

sollte

<form name="bizLoginForm" method="post" action="" > 

fehlt = Zeichen.

Sie fehlt auch das Attribut name in Ihrem Eingangs-Tags, so ändern

<input type="text" id="loginUsername" /> 

und

<input type="password" id="loginPassword" /> 

zu

<input type="text" id="loginUsername" name="loginUsername" /> 

und

<input type="password" id="loginPassword" name="loginPassword" /> 
+0

ARUGH !!! DOH !!! – ackerchez

+0

:-) html braucht vielleicht einen Compiler? – sjobe

+0

um, das hat es nicht gemacht .. – ackerchez

4
  • sollten Sie fügen gleich Zeichen zwischen Aktion und ""
  • Auch Name Attribut für jedes Eingabefeld angeben.

<?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> 
0

versuchen, diese

<?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 
} 
?> 
2

Versuchen Sie, diese

<?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> 

Speichern Sie die Datei mit Endung .php