如何从 PHP 中的单选按钮发送值属性 [英] How to send value attribute from radio button in PHP
本文介绍了如何从 PHP 中的单选按钮发送值属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在努力将单选按钮的值发送到电子邮件.
I am struggling with sending the value of a radiobutton to an email.
我编写了 2 个单选按钮,其中我将第一个设置为默认选中.
I have coded 2 radiobuttons, where I have set the first on to be default checked.
表单和值有效,但未提交单选按钮值.
The form and values work, however the radio button value is not submitted.
有什么明智的话吗?
推荐答案
当您选择一个单选按钮并单击一个提交按钮时,您需要使用 $_POST 处理您的 php 代码中任何选定值的提交[]
例如:如果您的单选按钮是:
When you select a radio button and click on a submit button, you need to handle the submission of any selected values in your php code using $_POST[]
For example:
if your radio button is:
<input type="radio" name="rdb" value="male"/>
然后在你需要使用的 php 代码中:
then in your php code you need to use:
$rdb_value = $_POST['rdb'];
这篇关于如何从 PHP 中的单选按钮发送值属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文