How to send global variables to php?

How can i send a global variable from flash to a php file to turn it into a regular variable (example: $cityname)?  please help.
500 points
Very Urgent.
leronj23Asked:
Who is Participating?
 
johanbarnardCommented:
In theory that should work:
Maybe just use:

$db = $_request("db");
$tableName = $_request("tb");

$dbc = @mysql_connect($server,$user,$pass)OR die ('Could not connect to MySQL: ' . mysql_error() );
$selected = @mysql_select_db($db,$dbc)OR die ('Could not connect to MySQL: ' . mysql_error() );
$query = @mysql_query("SELECT * FROM $tableName");

You are currently not using the variable names, in the mysql connection string.
0
 
dutchclanCommented:
Just Post/Get it in/to the php file. for instance..


(the value i want to send using GET --->username=Myself Cartitem=1001, Cartitem1=13342 etc

<?php

function fetch_post_get(){

   foreach($_POST as $key => $value){
             $post_get[$key] = $value;
   }
   foreach($_GET as $key => $value){
            $post_get[$key] = $value;
   }

   if(is_array($post_get) ){
            return $post_get;
   }else{
           return false;
   }
}

post to the file using get => myphp.php?user=myself&art1=10101&art2=boxer&art3=blaat

$post_get['user'] = myself,
$post_get['art1'] = 10101,
$post_get['art2'] = boxer,
$post_get['art3'] = blaat etc.

Or post it as you would a form to the php files. All will be fetched in the $_POST or $_GET or (older php) $HTTP_POST_VARS, $HTTP_GET_VARS...

Good Luck
0
 
johanbarnardCommented:
Hi,

Depending on your server setup, it could be as simple as:

$yourvariable = request("globalvarialname");

Hope it helps
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
leronj23Author Commented:
what script do i use to send the global variables from flash to php. do i us:

loadVariable("dbtb.php","POST")
0
 
johanbarnardCommented:
getURL ("getVars.php", "_blank", "POST");  

should do the trick, if you then echo $variablename it should print.

A nice example is on http://www.kirupa.com/forum/showthread.php?t=101228
0
 
leronj23Author Commented:
once i set up my variables in flash using:
$db = request("database");// global variable name
$tb = request("tables");// global variable name

i want to send these variables to my dbtb.php to connect to my sql server.

even though im not using text boxes. Can i still send the variables using the: get("dbtb.php,"_blank","POST");

that way when the variables are sent to my dbtb.php it will connect to my sql script:

database = $db;
tables = $tb;

$dbc = @mysql_connect($server,$user,$pass)OR die ('Could not connect to MySQL: ' . mysql_error() );

$databases = @mysql_select_db($databases,$dbc)OR die ('Could not connect to MySQL: ' . mysql_error() );

$query = @mysql_query("SELECT * FROM $tableName");

0
 
leronj23Author Commented:
$db = request("database");// global variable name
$tb = request("tables");// global variable name
getURL ("getVars.php", "_blank", "POST");  

the global variables are not posting to my php. can you please help.

$database = $_request("db");
$tableName = $_request("tb");
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.