寻找一点方向来构建一个PHP表单,该表单将被拆分为两部分,并以用户使用PayPal购买产品结束。带有PayPal的PHP表单
第一阶段提出一系列问题,如姓名,地址,电子邮件等。它还会询问一系列单选按钮的简单问题,如果他们不选择,那么用户会被告知有人会在触摸并在那里结束,如果他们选择了其他选项之一,那么他们将被带到第二阶段。
无论现在选择何种选项,阶段1中的所有信息都将通过电子邮件发送。
第二阶段基本上是获取用户的PayPal信息。
感谢
UPDATE:
我已经简化这个很大,所以现在只是一种形式,这将获取数据并将其发送到电子邮件,然后再根据有选择的单选按钮要么显示消息要么发送给PayPal。
我需要帮助检查收音机选项并显示信息/重定向到PayPal,并将信息发送到电子邮件地址。并将信息发送给PayPal。
的代码如下:
<?php if(isset($_POST['submit']))
{
$to = "[email protected]";
$subject = "SolidCAM Xpress";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['message'];
$company_field = $_POST['company'];
$reseller_field = $_POST['reseller'];
$body = "From: $name_field\n E-Mail: $email_field\n Phone:\n $phone_field\n Company:\n $company_field\n Reseller:\n $reseller_field";
mail($to, $subject, $body);
}
else {
?>
<form method="POST" action="">
<fieldset>
<legend>Purchase SolidCAM Xpress</legend>
<ul>
<li><label for="name">Name <input type="text" name="name" /></label></li>
<li><label for="email">Email <input type="text" name="email" /></label></li>
<li><label for="phone">Phone <input type="text" name="phone" /></label></li>
<li><label for="company">Company <input type="text" name="company" /></label></li>
</ul>
<p>Do you currently have SolidWorks, if yes who is your reseller?</p>
<ul>
<li><label for=""><input type="radio" name="reseller" value="None" /> Don't have SolidWorks</label></li>
<li><label for=""><input type="radio" name="reseller" value="Cad Connect" /> Cad Connect</label></li>
<li><label for=""><input type="radio" name="reseller" value="Cadtek" /> Cadtek</label></li>
<li><label for=""><input type="radio" name="reseller" value="CCSL" /> CCSL</label></li>
<li><label for=""><input type="radio" name="reseller" value="Innova" /> Innova</label></li>
<li><label for=""><input type="radio" name="reseller" value="NT CAD/CAM" /> NT CAD/CAM</label></li>
<li><label for=""><input type="radio" name="reseller" value="Solid Engineer" /> Solid Engineer</label></li>
<li><label for=""><input type="radio" name="reseller" value="Solid Solutions Ireland" /> Solid Solutions Ireland</label></li>
<li><label for=""><input type="radio" name="reseller" value="Solid Solutions Management" /> Solid Solutions Management</label></li>
<li><label for=""><input type="radio" name="reseller" value="TMS Scotland" /> TMS Scotland</label></li>
</ul>
<p><input type="submit" name="continue" value="Continue" /></p>
</fieldset>
</form>
<?php
}
// When user clicks continue send all data to [email protected]
// Then check if user has selected None from the last question then show the following and prevent them from proceeding
if() {
?>
<p>SolidCAM Xpress requires a valid copy of SolidWorks, we will be in touch shortly to discuss pricing!</p>
<?php
} else {
// User has selected something other than None, send them off to PayPal
}
?>
不能与贝宝肯定的是,有最佳做法的建议,然后请分享。我认为会话路线可能会更好,如上所述,如果用户选择“无”作为选项之一,但仍然需要执行邮件发送,则表单将在第2阶段退出。在同一页面上做这件事很容易吗?所以就像index.php?stage = 2一样,也阻止了一个人访问其他阶段而没有完成前一个阶段。 – Cameron 2010-09-24 17:40:26