Jump to content

Recommended Posts

Hi all,

 

I've got a flash front end for an image gallery. The images are pulled into

Flash via php which delivers a string of filepaths - this works fine.

 

Now I need to allow users to delete certain images if they choose so I need

to be able to pass a particular filepath to a new php file (delete.php).

 

I have the filepath of the currently displayed image as a variable in flash

called "delete_path".

 

QUESTION - how, (on a button trigger with AS2) can I pass this string "delete_path" to delete.php ?

 

WORTH KNOWING - there is tons of other dynamic data on the flash front end

and I don't really want to chuck it all at the php file - just the one variable "delete_path".

Link to comment
https://forums.phpfreaks.com/topic/181863-post-variable-from-flash-to-php/
Share on other sites

Your need to pass the parameter via a POST or a GET

for example (GET), delete.php?delete_path=123

the PHP would look like this

<?php
$delete_path = $_GET['delete_path'];
//do something with $delete_path

 

for example (POST), the PHP would look like this

<?php
$delete_path = $_POST['delete_path'];
//do something with $delete_path

 

Now my flash skills are.. well not that great! but this should work or at least give you a direction

your button would call an AS that would look like this

GET

var delete_path:string = "123";
getURL("delete.php?delete_path="+delete_path);

 

POST your use LoadVars.send or LoadVars.sendAndLoad

LoadVars.send does a POST (or GET) without opening a browser windows or displaying anything to the user.

LoadVars.sendAndLoad does the same thing while getting a return value from the target script.

userData = new LoadVars();
userData.delete_path = "123";
userData.send("delete.php", 0, "POST");

 

Hope that helps

  • 2 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.