Re: [請益] flash與php間變數的問題

看板PHP作者 (仁)時間17年前 (2008/08/09 19:04), 編輯推噓0(005)
留言5則, 2人參與, 最新討論串2/3 (看更多)
可能說的不是很清楚 我把程式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 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.165.15.85

08/09 19:34, , 1F
直接打參數你沒有給他 $_POST['Product'] 參數
08/09 19:34, 1F

08/09 19:34, , 2F
網址
08/09 19:34, 2F

08/09 19:46, , 3F
嗯嗯! 我試了改成GET方式就可以了
08/09 19:46, 3F

08/09 19:52, , 4F
那請問~如果是用post方式傳 php要怎麼抓到值??
08/09 19:52, 4F

08/09 21:04, , 5F
$_POST
08/09 21:04, 5F
文章代碼(AID): #18dNd1KP (PHP)
文章代碼(AID): #18dNd1KP (PHP)