Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send post data from flash to php/mySQL and display results in flash 1

Status
Not open for further replies.

brownfox

Programmer
Jan 5, 2003
173
GB
Could someone explain to me simply how to connect flash with my server and vice versa?
My flash movie takes a var from the URL string:
<param name="movie" value="product_info.swf?products_id=918">
and
<embed src="product_info.swf?products_id=918"...>
Getting the value of products_id is easy but I want to send the var products_id to a php page, do some mySQL on it and return the results to my flash movie. I'm using loadVariables (or sendAndLoad) but nothing comes back. I know the scripts are ok as i've tried to send the vars by getURL("page.php","_blank","POST") and it works but loadVars() doesn't. Thanks in advance!
 
you have to send the loadvars object

myLoadVars.sendandload("some.php",myloadvars,"POST");

ive got a couple of examples if you need them


 
I think I do need them. I will change my code to the above and get back to you with the results. Thanx 4 your response!
 
Cheers mate, it's working now. I do think flash is a bit buggy in places, would you agree?
 
for sure

with sendandload i get unpredictable results if i dont add the full url to the php file

always works with full url often works without but then for no good reason stops working

go figure
 
I dont get this line when displaying received data:
Code:
for (i=0; i<this.n; i++) {
where is the n from?
 
Hi Bill, the query is working but I'm not able to display the received data. The problem is here:
Code:
for (i=0; i<this.n; i++) {
messages.text += this["products_image"+i];
}
Any ideas?
 
No ignore that, the n comes from the php file. I am only returning one record so the for loop is not needed. It works! Brilliant, thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top