看板 PHP 關於我們 聯絡資訊
※ 引述《ransonasd (仁)》之銘言: : 可能說的不是很清楚 : 我把程式po上來 希望有人可以幫忙我解決~~ : 以下是我flash內寫的action script : on (release) { : //connect with php : var mySendVars:LoadVars = new LoadVars(); //負責丟資料出去的 : var myReciVars:LoadVars = new LoadVars(); //負責接受資料的 : mySendVars.Product="DHC"; : mySendVars.sendAndLoad("http://localhost/project1_test-widget/ccc.php", : myReciVars, "POST"); : myReciVars.onLoad = showText; : function showText():Void { : text3=myReciVars.prefer; : stop(); : } : 是用post的方式傳值到ccc.php : <?php : $prefer = $_POST['Product']; : $query = "select * from customer where prefer ='" .$prefer . "'"; : echo "&prefer="."$query"; : ?> : flash內的text3有抓到myReciVars.prefer的值 : select * from customer where prefer ='DHC' : 但我連到http://localhost/ccc.php時 卻只出現 : &prefer=select * from customer where prefer ='' : 為什麼flash內傳回的是對的 : 直接連到http://localhost/ccc.php : 變數值卻不見了 : 也因為變數值不見 我下的sql就不對 沒辦法連DB 仍然建議用POST的方式傳(因為對Flash而言看來沒差,能傳的東西也比較多) 如果你要用瀏覽器測POST方式的話,可以試著用一個HTML的form: (這裡為了方便,不管HTML是不是Valid了啦) 把這個存成aaa.htm: <html><body> <form action="ccc.php" method="POST"> Prefer: <input type="text" name="prefer" value=""> <input type="submit" value="試試看"> </form> </body></html> 這樣就可以run http://localhost/aaa.htm作測試 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.59.6
ransonasd :嗯嗯 了解~ 謝謝^^ 08/11 15:33