我從simplemodal的代碼開始,並進行修改以適應我的需要。這非常好。我最後一個問題是獲取一些單選按鈕來發布。我會跳過我認爲不必要的代碼塊,只顯示我認爲相關的內容。我嘗試了幾十次來自php.net的解決方案嘗試,但似乎沒有任何工作。無法獲得單選按鈕值在PHP中發佈
HTML
<label for='PayPlatform'>Are you willing to pay for a trading platform?</label>
<input type='radio' name='PayPlatform' value='Yes' tabindex='1001' />Yes
<input type='radio' name='PayPlatform' value='No' tabindex='1002' />No
此處,我不能得到的價值,我的嘗試有兩個企圖在下面的代碼塊,它們當然不會試圖在同一時間的。
else if ($action == "send") {
// other elements form values are retrieved fine, just not the below
$PayPlatform = isset($_POST['PayPlatform']) ? ' checked="checked"' : "";
//the ternary above just submits 'checked="checked" no matter which radio is checked
//another attempt
$PayPlatform = isset($_POST["PayPlatform"]);
//this just submits "1" weather yes or no is checked
$token = isset($_POST["token"]) ? $_POST["token"] : "";
// make sure the token matches
if ($token === smcf_token($to)) {
smcf_send($name, $email, $subject, $phone, $message, $PayPlatform);
echo "Your message was successfully sent, you can close this window";
}
else {
echo "Unfortunately, your message could not be verified.";
}
}
的var_dump($ _ POST)是你的朋友 – sdjuan 2012-03-29 20:16:33
@sdjuan - 我做了轉儲$ _ POST,則顯示「是」爲我檢查是每個值,但我可以不要讓它提交是的...見下面 – 2012-03-29 20:20:43
你可以發佈你的var_dump嗎?也許這將有助於解決這個問題。呃,沒關係,我認爲科爾賓是對的。 – Gohn67 2012-03-29 20:25:39