php 表單資料的擷取代碼

來源:互聯網
上載者:User

複製代碼 代碼如下:<html>
<head>
<title>Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<form action="post.php" method="get" name="form1">
<table width="271" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="85"><div align="right">姓名:</div></td>
<td width="186"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td><div align="right">密碼:</div></td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td><div align="right">密碼確認:</div></td>
<td><input name="password2" type="password" id="password2"></td>
</tr>
<tr>
<td><div align="right">性別:</div></td>
<td><select name="sex" id="sex">
<option value="0" selected>男</option>
<option value="1">女</option>
</select></td>
</tr>
<tr>
<td><div align="right">生日:</div></td>
<td><input name="birthday" type="text" id="birthday"></td>
</tr>
<tr>
<td><div align="right">E-mail:</div></td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td><div align="right">職業:</div></td>
<td><input name="job" type="text" id="job"></td>
</tr>
</table>
<p align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</p>
</form>
</body>
</html>複製代碼 代碼如下:<?php
//本程式用於接收來自HTML頁面的表單資料,並輸出每個欄位
echo "使用者的輸入如下所示:<BR>";
echo "姓名:".$_GET['username']."<BR>";
echo "密碼:".$_GET['password']."<BR>";
echo "密碼確認:".$_GET['password2']."<BR>";
echo "性別:".$_GET['sex']."<BR>";
echo "生日:".$_GET['birthday']."<BR>";
echo "E-mail:".$_GET['email']."<BR>";
echo "職業:".$_GET['job']."<BR>";
?>複製代碼 代碼如下:<?php
//本程式用於接收來自HTML頁面的表單資料,並輸出每個欄位
echo "使用者的輸入如下所示:<BR>";
echo "姓名:".$_POST['username']."<BR>";
echo "密碼:".$_POST['password']."<BR>";
echo "密碼確認:".$_POST['password2']."<BR>";
echo "性別:".$_POST['sex']."<BR>";
echo "生日:".$_POST['birthday']."<BR>";
echo "E-mail:".$_POST['email']."<BR>";
echo "職業:".$_POST['job']."<BR>";
?>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.