PHP 的 $_GET 和 $_POST 用于检索表单中的值,比如用户输入。

 

index.php页面

<?php 
/*时间:2014-09-14
 *作者:葛崇
 *功能:表单传值小实例
 * 
*/
?>
<form action="action.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />

</form> 

 

action.php页面

 <?php 

$user = $_POST['name'];
$age = $_POST['age'];
echo "来自index.php传过来的数值!"."<p>";
echo "Your Name is :"."$user"."<p>";
echo "Your Age is :"."$age"."<p>";
?>

相关文章:

  • 2021-11-24
  • 2022-12-23
  • 2021-12-13
  • 2021-11-27
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
  • 2021-07-06
猜你喜欢
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
相关资源
相似解决方案