PDA

View Full Version : How to get user input from actionscript to be pass to PHP


rocky86
08-03-2007, 10:01 AM
how to pass user input from actionscript to php?

iszit like that?

Actionscript
postalOut.postal=postal.text;
var postalOut:LoadVars = new LoadVars();
postalOut.sendAndLoad(passingurl, postalIn, "GET");


I want the postal.text to be send to php so is my code correcT?

CyanBlue
08-03-2007, 10:12 AM
Howdy and Welcome... :)

I don't know the syntax difference in AS3, but you do this in AS2... You might want to double check the manual for the correct syntax...
var postalOut:LoadVars = new LoadVars();
postalOut.postal=postal.text;
postalOut.sendAndLoad(passingurl, postalIn, "GET");

rocky86
08-06-2007, 02:39 AM
Hi I want to know how do I get an user input from actionscript to pass to PHP

My php code is like that:

$_GET["postal"]
$postalno=$_GET["postal"];


What is wrong with it ? it does not seen to work, the postal is the name of the input textbox in actionscript.

My actionscript:
postalOut.assign.postal=postal.text;
var postalOut:LoadVars = new LoadVars();
postalOut.sendAndLoad(passingurl, postalIn, "GET");

rocky86
08-06-2007, 03:26 AM
Hi I want to know how do I get an user input from actionscript to pass to PHP will be taking the first 2 value out and store inside a variable to be use in the SQL statement I try both the GET and POST method alreadx but it does not work pls help

My php code is like that:

PHP Code:

$postalno=substr($_POST['postal'],0,2);
$resultpostal=mysql_query("SELECT location.uname,location.uid FROM location,districts WHERE districts.districtno ='$postalno' AND
location.lat BETWEEN districts.startlat AND districts.endlat AND location.lng BETWEEN districts.startlng AND districts.endlng");




What is wrong with it ? it does not seen to work, the postal is the name of the input textbox in actionscript.

My actionscript:

postalOut.assign.postal=postal.text;
var postalOut:LoadVars = new LoadVars();
postalOut.sendAndLoad(passingurl, postalIn, "GET");

Cota
08-06-2007, 04:41 AM
This should work

var postalOut:LoadVars = new LoadVars();

postalOut.postal=postal.text;

postalOut.sendAndLoad(passingurl, postalOut, "GET");




$postalno=$_GET["postal"];

echo "&Dummy=1&";

rocky86
08-06-2007, 06:03 AM
Thx for yr help manage to solve it can I ask you how do I display more then 1 record from the php cause right now my php is able to just display 1 record instead 2 record that matches the sql condition I understand my code is just able to take in the first row value only so how do I make it that it will not just take only the first row value but all the row value that matches the sql condition?

my php code

$postalno=$_GET["postal"];


$resultpostal=mysql_query("SELECT location.uname,location.uid FROM location,districts WHERE districts.districtno ='$postalno' AND
location.lat BETWEEN districts.startlat AND districts.endlat AND location.lng BETWEEN districts.startlng AND districts.endlng");

$counterx=0;
while($row=mysql_fetch_array($resultpostal)){
foreach($row as $col_value){
$temp[$counterx]=$col_value;
$counterx++;
}


$report.="uid"."=".$temp[0]."&";
$report.="uname"."=".$temp[1]."&";





Please help me this is urgent!!

rocky86
08-06-2007, 10:30 AM
Hi I having problem here how come the uid is undefined value on the actionscripts? the uname is able to be display but the uid is undefinded but I don't know why it return undefinded value?


$resultpostal=mysql_query("SELECT location.uname,location.uid FROM location,districts WHERE districts.districtno ='$postalno' AND
location.lat BETWEEN districts.startlat AND districts.endlat AND location.lng BETWEEN districts.startlng AND districts.endlng");

$counterx=0;
while($row=mysql_fetch_array($resultpostal)){
foreach($row as $col_value){
$temp[$counterx]=$col_value;
$counterx++;
}


$report.="uid"."=".$temp[0]."&";
$report.="uname"."=".$temp[1]."&";



echo $report;


Anybody know?

CyanBlue
08-06-2007, 02:07 PM
I merged your crossposts... Please keep your question to one thread... :(

Cota
08-06-2007, 03:04 PM
Start your variables with "&"..all of them