[ad_1]
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sign Up Form Example</title> <link rel="stylesheet" type="text/css" href="css/bootstap.min.css"> <style> div label { display: inline-block; width: 150px; } </style> </head> <body> <div> <?php if(isset($_POST['create'])) { echo 'User Submitted'; } ?> </div> <div> <form action="registration.php" method="post"> <div class="container"> <h1>Sign Up Form Example</h1> <label for="Firstname"> First, Last Name*:</h></label> <input type="text" size="20" maxlength="50" name="First" required> <input type="text" size="20" maxlength="50" name="Last Name" required> <br><br> <label for="Organization">Organization:</h></label> <input type="text" size="42" maxlength="50" name="Organization"> <br><br> <label for="Email Address">Email Address*:</h></label> <input type="Email Address" size="42" maxlength="50" name="Email Address" required> <br><br> <label for="Work Phone">Work Phone:</h></label> <input type="text" size="30" maxlength="50" name="Work Phone"> <br><br> <label for="Home Phone">Home Phone:</h></label> <input type="text" size="30" maxlength="50" name="Home Phone"> <br><br> <label for="Cell Phone">Cell Phone:</h></label> <input type="text" size="30" maxlength="50" name="Cell Phone"> <br><br> <label for="Fax">Fax:</h></label> <input type="text" size="30" maxlength="50" name="Fax"> <br><br> <label for="Address1">Address1*:</h></label> <input type="text" size="50" maxlength="50"name="Address1" required> <br><br> <label for="Address2">Address2:</h></label> <input type="text" size="50" maxlength="50"name="Address2"> <br><br> <label for="City">City*:</h></label> <input type="text" size="42" maxlength="50" name="City" required> <br><br> <label for="State/Province">State/Province:</h></label> <input type="text" size="42" maxlength="50"name="State/Province"> <br><br> <label for="Zip/Postal Code">Zip/Postal Code:</h></label> <input type="text" size="10" maxlength="50" name="Zip/Postal Code"> <br><br> <label for="Country">Country*:</h></label> <input type="text" size="42" maxlength="50"name="Country" required> <br><br> <label for="required">* - required fields</h></label> <input type="submit" name="submit" value="Submit"> </div> </form> </div> </body> </html>
私が試したこと:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sign Up Form Example</title> <link rel="stylesheet" type="text/css" href="css/bootstap.min.css"> <style> div label { display: inline-block; width: 150px; } </style> </head> <body> <div> <?php if(isset($_POST['create'])) { echo 'User Submitted'; } ?> </div> <div> <form action="registration.php" method="post"> <div class="container"> <h1>Sign Up Form Example</h1> <label for="Firstname"> First, Last Name*:</h></label> <input type="text" size="20" maxlength="50" name="First" required> <input type="text" size="20" maxlength="50" name="Last Name" required> <br><br> <label for="Organization">Organization:</h></label> <input type="text" size="42" maxlength="50" name="Organization"> <br><br> <label for="Email Address">Email Address*:</h></label> <input type="Email Address" size="42" maxlength="50" name="Email Address" required> <br><br> <label for="Work Phone">Work Phone:</h></label> <input type="text" size="30" maxlength="50" name="Work Phone"> <br><br> <label for="Home Phone">Home Phone:</h></label> <input type="text" size="30" maxlength="50" name="Home Phone"> <br><br> <label for="Cell Phone">Cell Phone:</h></label> <input type="text" size="30" maxlength="50" name="Cell Phone"> <br><br> <label for="Fax">Fax:</h></label> <input type="text" size="30" maxlength="50" name="Fax"> <br><br> <label for="Address1">Address1*:</h></label> <input type="text" size="50" maxlength="50"name="Address1" required> <br><br> <label for="Address2">Address2:</h></label> <input type="text" size="50" maxlength="50"name="Address2"> <br><br> <label for="City">City*:</h></label> <input type="text" size="42" maxlength="50" name="City" required> <br><br> <label for="State/Province">State/Province:</h></label> <input type="text" size="42" maxlength="50"name="State/Province"> <br><br> <label for="Zip/Postal Code">Zip/Postal Code:</h></label> <input type="text" size="10" maxlength="50" name="Zip/Postal Code"> <br><br> <label for="Country">Country*:</h></label> <input type="text" size="42" maxlength="50"name="Country" required> <br><br> <label for="required">* - required fields</h></label> <input type="submit" name="submit" value="Submit"> </div> </form> </div> </body> </html>
解決策 1
入力で使用する必要があります[id=item] 入力しない[name=item]
コードの結果を取得するには、registration.php に追加します。
var_dump($_POST); // dd($_POST);
また
エコー ‘
'; print_r($_POST); echo '
‘;
[ad_2]
コメント