这篇文章主要为大家详细介绍了php 获取表单单选框radiobutton数据的简单示例,具有一定的参考价值,可以用来参考一下。
对php中获取表单单选框radiobutton数据的方法感兴趣的小伙伴,下面一起跟随四海网的小编两巴掌来看看吧!
/**
* php中获取表单单选框radiobutton数据的方法
*
* @param
* @arrange 512-笔记网: www.q1010.com
**/
<html>
<body>
<form action="mychoice.php" method="post">
<b>Enter Name:</b>
<input type="text" size="45" name="username"> <br>
<b>Please select your favorite animal:</b> <br>
<input type="radio" name="animal" value="dog">Dog
<input type="radio" name="animal" value="cat">Cat
<input type="radio" name="animal" value="fish">Fish <br>
<input type="submit" value="Submit">
</form>
</body>
</html>
/*** 来自四海网(www.q1010.com) ***/
后台php文件:
/**
* php中获取表单单选框radiobutton数据的方法
*
* @param
* @arrange 512-笔记网: www.q1010.com
**/
<html>
<head>
<title>Form submission</title>
</head>
<body>
<br>
<?php
$username = $_POST['username'];
$animal = $_POST['animal'];
if(($animal != null))
{
$msg = "The animal you chose is $animal <br>";
echo($msg);
}
?>
</body>
</html>
/*** 来自四海网(www.q1010.com) ***/
本文来自:http://www.q1010.com/173/824-0.html
注:关于php 获取表单单选框radiobutton数据的简单示例的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。
关键词:表单,radiobutton
四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。