0

我不确定它到底叫什么,但我真的很想有一个底部有两个单选按钮的表单,说你有一个客户是/否,如果他们点击是,还有一点表格出现。这是文件中的代码,它是 PHP。

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$to = "email" ;
$subject = "New Enquiry" ;
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$address = $_REQUEST['address'] ;
$address2 = $_REQUEST['address2'] ;
$postcode = $_REQUEST['postcode'] ;
$city = $_REQUEST['city'] ;
$tel = $_REQUEST['tel'] ;
$tel2 = $_REQUEST['tel2'] ;
$club = $_REQUEST['club'] ;
$which = ", " . $_REQUEST['which'] ;
$passdetails = $_REQUEST['updates'] ;
$cname = $_REQUEST['cname'] ;
$ctel = $_REQUEST['ctel'] ;
$cloan = $_REQUEST['cloan'] ;
$creasons = $_REQUEST['creasons'] ;
$message = "Name: " . $name . "\n Email: " . $email . "\n Address: " . $address . ", " .     $address2 . "\n Postcode: " . $postcode . "\n City: " . $city . "\n Telephone Number: " . $tel . "\n Alternative Number: " . $tel2 . "\n Member of a club?: " . $club . $which . "\n Can use details: " . $passdetails . "\n" . "\n Client Details (Optional): " . "\n" . "\n Client Name: " . $cname . "\n Client Telephone Number: " . $ctel . "\n Loan Amount: " . $cloan . "\n Reasons for loan: " . $creasons ;
$from = "Introducer Registration" ;

mail($to,$subject,$message,"From: " . $from) ;

echo "<p style='font-size:12px;font-family:helvetica;color:#000000;'>Thank you for using our enquiry form, a member of the team will contact you as soon as they can.</p>";
}
else
//if "email" is not filled out, display the form
{
echo "<form action='register.php' method='post' style='width:21cm;font-family:helvetica;font-size:12px;'>

<p style='font-size:12px;padding-bottom:3px;margin-bottom:3px;'><I>* = required</I></p>
<label>Name*</label><label style='margin-left:353px;'>Email*</label><br />
<input type='text' style='width:10cm;padding-top:4px;' name='name' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='email' />
<br />

<label>Address Line One*</label><label style='margin-left:289px;'>Address Line Two</label><br />
<input type='text' style='width:10cm;padding-top:4px;' name='address' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='address2' />
<br />

<label>Town/City</label><label style='margin-left:338px;'>Postcode*</label><br />
<input type='text' style='width:10cm;padding-top:4px;margin-bottom:0px;' name='city' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;' name='postcode' />
<br />

<label>Phone Number*</label><label style='margin-left:304px;'>Alternative Number</label><br />
<input type='text' style='width:10cm;padding-top:4px;margin-bottom:0px;' name='tel' />
<input type='text' style='width:10cm;padding-top:4px;margin-left:10px;margin-bottom:0px;' name='tel2' />
<br />

<br />
<label style='margin-top:-10px;'>Are you a member of a club?*</label><label style='margin-left:231px;margin-top:-10px;'>If yes, which club?</label><br />
<input type='radio' name='club' value='Yes' style='margin-top:-10px;' /><span style='font-family:source sans pro;color:#000000;'>Yes</span>
<input type='radio' name='club' value='No' /><span style='font-family:source sans pro;color:#000000;'>No</span>
<input type='text' name='which' style='font-family:source sans pro;color:#000000;;width:10cm;margin-left:320px;margin-top:0px;' />
<br />
<br />
<input type='hidden' name='updates' value='Yes' />
<input type='checkbox' name='updates' value='No'/><label style='font-family:source sans pro;color:#000000;' value='updates'>*If you <u>DO NOT</u> wish to be contacted by affiliated companies with potentially helpful products and services, please tick this box.</label>
<br />
<br />
<h9 style='font-size:14px;'>Enter Client Details for assessment <i>(optional)</i></h9>
<br />
<br />
<label>Name</label><label style='margin-left:360px;'>Phone Number</label><br />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;' name='cname' />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;margin-left:10px;' name='ctel' />
<br />

<label>Loan Amount</label><label style='margin-left:319px;'>Reasons for loan</label><br />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;' name='cloan' />
<input type='text' style='font-family:source sans pro;color:#000000;width:10cm;padding-top:4px;margin-left:10px;' name='creasons' />
<br />


<br />
<input style='margin-left:713px;padding:0;' type='submit' value='Submit' />

</form>";
}
?>

</body>
</html>

在“输入客户详细信息以进行评估”之前,我真的很想拥有它,这样他们就可以选择是否拥有它们,然后如果有,则表格会下拉,但这一切都是通过电子邮件发送的,我希望如此他们将在同一封电子邮件中。

谢谢你的帮助!

4

1 回答 1

0

将“输入客户详细信息以进行评估”部分放在 DIV 中,并将此 DIV 的 CSS 设置为:

display:none

这会将其隐藏起来。

在“是”单选元素中放置一个 onclick,以便在选择它时运行一个 JavaScript 函数,该函数会将 div 的样式更改为:

display:inline

然后,您可能希望将另一个 onclick 添加到“否”单选元素,这样如果选择了该元素,它会将显示转回隐藏状态。

于 2013-01-04T10:41:30.387 回答