尋找一點方向來構建一個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