看板 PHP 關於我們 聯絡資訊
大家好,我是新手。 最近試著自己寫訂購單的表單,結合paypal的立即購。 設定是按下送出鈕後,導入到paypal的付款頁面 在我按下送出鈕的時候,就跑到空白頁面了。 不知道是哪個環節沒有寫到 << 以下是index.php 的表單 >> <form action="orderinfo.php" method="post"> <div id="content"> ... <!--這裡是paypal產生的程式碼 --> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="6352N3RD6AKFY"> <table> <tr><td> <h2><input type="hidden" name="on0" value="Quantity">Quantity </h2></td></tr> <tr><td> <select id="casenum" name="os0"> <option value="A">A $100.00 USD</option> <option value="B">B $150.00 USD</option> </select> </td></tr> </table> </br> <input type="hidden" name="currency_code" value="USD"> <input type="image" src="http://xxx.jpg" border="0" name="submit" alt="PayPal - 更安全、更簡單的線上付款方式!"> <img alt="" border="0" src=" https://www.paypalobjects.com/zh_TW/i/scr/pixel.gif" width="1" height="1"> </form> << 以下是orderinfo.php >> <?php if ((isset($_post["insert"])) && ($_POST["insert"] == "order info")) { mysql_select_db('moo'), $connection) or die('DB does'nt exist'); $query = sprintf(INSERT INTO member (name, shipping addres, ZIP/Postal Code, country, email, phone, news, casenum) VALUES (%S, %S, %S, %S, %S, %S, %S, $S)", GetSQLValue ($_POST['name'], "text"), GetSQLValue ($_POST['shipping address'], "text"), GetSQLValue ($_POST['ZIP/Postal Code'], "text"), GetSQLValue ($_POST['countrye'], "text"), GetSQLValue ($_POST['email'], "text"), GetSQLValue ($_POST['phone'], "text"), GetSQLValue ($_POST['news'], "text") GetSQLVaule ($_POST['casenum'], "SET")); $result = mysql_query($query, $connection); if ($result) { header(sprintf("Location: https://www.paypal.com", $_SESSION['paypal'])); } } ?> -- Bonjour Taiwan - H.Tabrio http://tabrio.blogspot.com/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.104.150.253
kerash:$_post->$_POST 12/29 13:02
airtsubasa:我習慣傳值的時候 用echo把值給show出來確認後再註解 12/29 23:10
kerash:再加一個 >> GetSQLVaule 打錯字 12/30 09:17
Yench:兩個程式碼的欄位名稱似乎對不起來...所以抓不到值 12/31 14:31
Yench:前端form裡面的name要等於後端$_POST裡面的值 12/31 14:33
Yench:前端 name=apple 後端 $_POST[apple] 12/31 14:34
Yench:name="apple" 12/31 14:34