• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

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.
0
leronj23
Asked:
leronj23
  • 3
  • 3
1 Solution
 
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
 
leronj23Author Commented:
what script do i use to send the global variables from flash to php. do i us:

loadVariable("dbtb.php","POST")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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
 
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now