nyghtrunner
06-29-2007, 06:36 PM
Hi all,
So I've been using actionscript for a while now, and am just getting into PHP. he biggest reason is that I need things to be able to post to a dbase from flash, and then to allow flash to retrieve things from the dbase. The retrieving isn't really a problem, but the sending is a real challenge since I don't really know PHP at all. Anyways, here a sample of some code I'm trying to use to have my flash file send something, have PHP look at it and process it, and then send it right back to flash (no dbase interaction at this point).
///////////////////////////Function that calls and passes info to the PHP and then gathers return data//////////////////////
tester.buttonHolder_mc.s1_mc.onRelease = function() {
var input1 = tester.textHolder_mc.nameInput.text;
var input2 = tester.textHolder_mc.postInput.text;
tester.textHolder_mc.nameInput.text = "type name here";
tester.textHolder_mc.nameInput.setTextFormat(forma tInput_fmt);
tester.textHolder_mc.postInput.text = "type submission here";
tester.textHolder_mc.postInput.setTextFormat(forma tInput_fmt);
var poster = new LoadVars();
poster.nameText = input1;
poster.postText = input2;
poster.onLoad = addPost();
poster.sendAndLoad("tester.php",poster,"POST");
}
function addPost() {
tester.textHolder_mc.postOutput.text = poster.soapOut;
tester.textHolder_mc.postOutput.setTextFormat(form atOutput_fmt);
}
I know this is pretty much working as I need it to internally, but here's what I don't know... This is the PHP starter I have. As I said, I'm new to the PHP thing, so it might be totally wrong, but I really just want it to accept the data and spit it right back into flash.
<?php
// Incoming data via Post
$nameText = $HTTP_POST_VARS[nameText];
$postText = $HTTP_POST_VARS[postText];
// Include the NuSoap Class's.
require_once('nusoap.php');
// Add necessary Parameters.
$parameters = array(
"nametext" =>$nameText,
"posttext" =>$postText
);
$result = "$nameText+$postText";
// Print the result.
print "&soapOut=$result&";
?>
Assume I'm stupid about PHP. I can look at it and see what it's doing for the most part, as I have been programming for a short while now, but I am not at all familiar enough with the syntax or the structure to be able to write it... :mad:
Anyways, any help would be appreciated!
Stephen
So I've been using actionscript for a while now, and am just getting into PHP. he biggest reason is that I need things to be able to post to a dbase from flash, and then to allow flash to retrieve things from the dbase. The retrieving isn't really a problem, but the sending is a real challenge since I don't really know PHP at all. Anyways, here a sample of some code I'm trying to use to have my flash file send something, have PHP look at it and process it, and then send it right back to flash (no dbase interaction at this point).
///////////////////////////Function that calls and passes info to the PHP and then gathers return data//////////////////////
tester.buttonHolder_mc.s1_mc.onRelease = function() {
var input1 = tester.textHolder_mc.nameInput.text;
var input2 = tester.textHolder_mc.postInput.text;
tester.textHolder_mc.nameInput.text = "type name here";
tester.textHolder_mc.nameInput.setTextFormat(forma tInput_fmt);
tester.textHolder_mc.postInput.text = "type submission here";
tester.textHolder_mc.postInput.setTextFormat(forma tInput_fmt);
var poster = new LoadVars();
poster.nameText = input1;
poster.postText = input2;
poster.onLoad = addPost();
poster.sendAndLoad("tester.php",poster,"POST");
}
function addPost() {
tester.textHolder_mc.postOutput.text = poster.soapOut;
tester.textHolder_mc.postOutput.setTextFormat(form atOutput_fmt);
}
I know this is pretty much working as I need it to internally, but here's what I don't know... This is the PHP starter I have. As I said, I'm new to the PHP thing, so it might be totally wrong, but I really just want it to accept the data and spit it right back into flash.
<?php
// Incoming data via Post
$nameText = $HTTP_POST_VARS[nameText];
$postText = $HTTP_POST_VARS[postText];
// Include the NuSoap Class's.
require_once('nusoap.php');
// Add necessary Parameters.
$parameters = array(
"nametext" =>$nameText,
"posttext" =>$postText
);
$result = "$nameText+$postText";
// Print the result.
print "&soapOut=$result&";
?>
Assume I'm stupid about PHP. I can look at it and see what it's doing for the most part, as I have been programming for a short while now, but I am not at all familiar enough with the syntax or the structure to be able to write it... :mad:
Anyways, any help would be appreciated!
Stephen