<script type="text/javascript">
function show() { document.getElementById('area').style.display = 'block'; }
function hide() { document.getElementById('area').style.display = 'none'; }
</script>
<form action="email.php" name="form" id="form" onSubmit="return check()" method="post">
<input type="text" name="Fname"/><br />
<input type="text" name="Lname"/><br />
<input type="text" name="Address"/><br />
<input type="text" name="City"/><br />
<input type="text" name="State"/><br />
<input type="text" name="Zip"/><br />
<input type="text" name="Email"/><br />
<input type="text" name="Phone"/><br />
<input type="radio" name="Donation" value="One Time Annual, Gift of $365.00" onclick="hide();" />One Time Annual, Gift of $365.00<br />
<input type="radio" name="Donation" value="Monthly Gift of $30.00" onclick="hide();" />Monthly Gift of $30.00<br />
<input type="radio" name="Donation" value="Monthly Gift of $30.00" onclick="hide();" />Monthly Gift of $30.00<br />
<input type="radio" name="Donation" value="At Least $1 Per Day" onclick="hide();" />At Least $1 Per Day<br />
<input type="radio" name="Donation" onclick="show();" />I would like to give a one time gift of
<input type="text" id="area" name="Donation" style="display: none;" />
<input type="submit" value="Submit" name="action"/>
and in email.php page i use array('First Name','Last Name','Address','City','State','Zip','Email','Phone','Donation')``
当我选择最后一个单选按钮然后在电子邮件中,当我使用任何其他单选按钮时,值不会在电子邮件中,请帮助我...
答案 0 :(得分:0)
所有单选按钮都有相同的名称,这是正确的。但是您的最后一个文本字段也是同名。请将文本字段名称从“捐赠”更改为其他内容并尝试。
答案 1 :(得分:0)
检查此
<script type="text/javascript">
function show() { document.getElementById('area').style.display = 'block'; }
function hide() {
document.getElementById('area').style.display = 'none';
var elements = document.getElementsByName('Donation');
for (var i=0, len=elements.length; i<len; ++i) {
if (elements[i].checked)
document.getElementById('Email').value = elements[i].value;
}
}
</script>
<input type="text" id ="Email" name="Email"/>
答案 2 :(得分:0)
删除最后一个单选按钮的名称,当您单击此名称时,它将显示目标输入文本字段。这样你就不会有双目的地帖子。