我不确定它的名字是什么,但我真的想要一个表格底部有两个单选按钮,说你有一个客户是/否,如果他们点击是,出现了另一种形式。这是文件中的代码,它是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>
在“输入客户详细信息以进行评估之前,我真的想拥有它,以便他们可以选择是否拥有它们,然后如果他们这样做,表格会下降,但这一切都通过电子邮件发送,我会喜欢它,所以他们会在同一封电子邮件中。
感谢您的帮助!
答案 0 :(得分:0)
在DIV中输入“为评估输入客户详细信息”部分,并将此DIV的CSS设置为:
display:none
这会将其隐藏起来。
在“是”单选元素中放置一个onclick,以便在选中它时,运行一个JavaScript函数,将div的样式更改为:
display:inline
然后你想要在'No'无线电元素上添加另一个onclick,这样如果选择了那个,它会将显示变回隐藏状态。