php獲取表單資料
阿新 • • 發佈:2022-03-27
<!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>"; } ?>