作者ransonasd (仁)
看板PHP
標題Re: [請益] flash與php間變數的問題
時間Sat Aug 9 19:04:32 2008
可能說的不是很清楚
我把程式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
→ starjou :直接打參數你沒有給他 $_POST['Product'] 參數 08/09 19:34
→ starjou : 網址 08/09 19:34
→ ransonasd :嗯嗯! 我試了改成GET方式就可以了 08/09 19:46
→ ransonasd :那請問~如果是用post方式傳 php要怎麼抓到值?? 08/09 19:52
→ starjou :$_POST 08/09 21:04