Jump to content

PHP grabbing url for string after question mark


phpfreakjav

Recommended Posts

I have a flash movie that sends data to results.php

var sender = new LoadVars();

sender.xy = "someVariableValue";

sender.send('http://localhost/crazy_experiments/biomed/results.php', '', 'POST');

The result of this command is that the url in results.php appends to the following

http://localhost/crazy_experiments/biomed/results.php?xy=someVariableValue

 

The question: How do I grab the someVariableValue String from the url.

I solve the problem! The problem was that I was running the movie as a standalone swf file. When I inserted the movie into html

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="550" height="400" accesskey="1" tabindex="2" title="Mouse">
  <param name="movie" value="14.swf">
  <param name="quality" value="high">
  <embed src="14.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="400"></embed>
</object>

The problem was fixed! thanks for making me think!

I solved that issue after putting the data into a function call like this : This function shows how to pass an array onclick in flash to php.

 

var testing = new Array();

testing[0]="american explorer";

sData.onRelease = function()

{

sender.testing = testing[0];

sender.send('http://localhost/crazy_experiments/biomed/results.php','','POST');

 

}

 

php code is

$dataReceived= array($HTTP_POST_VARS["testing"]);//multidimensional array

$variable = $_POST['xy'];

 

Or request if it's coming from the URL..

 

$variable = $_REQUEST['xy'];

 

Actually , The $_REQUEST function can be used to collect form data sent with both the GET and POST methods.

 

Yes, but if you know where the data should be it is best to get it directly from there. $_REQUEST can cause security issues.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.