php获取表单数据
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form action="wecome.php" method="post"> 姓名:<input type="text" name="myname"><br> 密码:<input type="text" name="pwd"><br> 性别:<input type="text" name="gender"><br> 学历:<select name="xueli" id=""><br> <option value="博士">博士</option> <option value="硕士">硕士</option> </select> <br> 爱好:<input type="checkbox" name="aihao[]" value="篮球">篮球 <input type="checkbox" name="aihao[]" value="象棋">象棋 <input type="checkbox" name="aihao[]" value="乒乓球">乒乓球 <br> <input type="submit" > </form> </body> </html>
php
你的名字是:<?php echo $_POST["myname"]; ?><br> 你的密码是:<?php echo $_POST["pwd"]; ?><br> 你的性别是:<?php echo $_POST["gender"]; ?><br> 你的学历是:<?php echo $_POST["xueli"]; ?><br> 你的爱好是:<?php $aihao = $_POST["aihao"]; for ($i=0;$i<count($aihao);$i++){ echo $aihao[$i]."< br>"; } ?>