Do we have any PHP programers in the house? I have a bit of an issue reading some variables from a server array... and im confused!
I've done some php, whats the problem?
Chris
Basically...
if I look at the URL it looks like this:
quote:
http://webappdomainname/index.phtml?d=136435&preview=1&t=1259923523
quote:
# <?php # print '<pre>' . htmlspecialchars(print_r(get_defined_vars(), true)) . '</pre>'; # ?>
quote:
[QUERY_STRING] => domain=ZnZlcg%3D%3D&company_id=79&contact_id=7226&selected_contact_id=&document_id=136435&document_stack=a:1:{i:0;i:136435;}&u ser_var_page_name=get+defined+variable&user_var_page_description=&user_var_page_published_date=4th+December+2009&user_var_page_modified_da te=4th+December+2009&user_var_page_created_by=john+smith&user_var_page_modified_by=john+smith&user_var_custom_icon=&frame_id=244892
quote:
1. <?php 2. 3. echo $_get['contact_id']; 4. 5. ?>
Could it be in the session variables?
ie SESSION['contact_id']
Failing that, i found this example which should help (with a little mod):
quote:
After a fruitless attempt find a built-in function whic did this, I wrote this functions to find out all the variables (well, those I wanted) in current scope and their values. I believe this is going to be handy in debugging.
<?php
/**
* @desc works out the variables in the current scope(from where function was called).
* Returns an array with variable name as key and vaiable value as value
* @param $varList: variables returned by get_defined_vars() in desired scope.
* $excludeList: variables to be excluded from the list.
* @return array
*/
function getDefinedVars($varList, $excludeList)
{
$temp1 = array_values(array_diff(array_keys($varList), $excludeList));
$temp2 = array();
while (list($key, $value) = each($temp1)) {
global $$value;
$temp2[$value] = $$value;
}
return $temp2;
}
/**
* @desc holds the variable that are to be excluded from the list.
* Add or drop new elements as per your preference.
* @var array
*/
$excludeList = array('GLOBALS', '_FILES', '_COOKIE', '_POST', '_GET', 'excludeList';
//some dummy variables; add your own or include a file.
$firstName = 'kailash';
$lastName = 'Badu';
$test = array('Pratistha', 'sanu', 'fuchhi';
//get all variables defined in current scope
$varList = get_defined_vars();
//Time to call the function
print "<pre>";
print_r(getDefinedVars($varList, $excludeList));
print "</pre>";
?>
I tried that bit of code from the PHP manual... thats what gives me the massive list of variables...
Session doesnt work
Can you stick the long Query String through the parse_str() function to get it ?
I'll have a think about it when I get a spare minute.
Cheers,
Tim.
http://www.php.net/manual/en/function.parse-str.php
That might explain a few things...
But im not sure what exactly to try... appreciate any thoughts
I would have expected all the arguments to be in the $argv array, but know there is some issue with having to set something in the php.ini.
if you do this what do you get :
foreach($_SERVER['argv'] as $k=>$v)
echo "$k -> $v n";
[Edited on 4/12/2009 by TimEllershaw]
If its a posted form you need to use $_POST["Contract_Id"]
quote:
Originally posted by TimEllershaw
I would have expected all the arguments to be in the $argv array, but know there is some issue with having to set something in the php.ini.
if you do this what do you get :
foreach($_SERVER['argv'] as $k=>$v)
echo "$k -> $v n";
[Edited on 4/12/2009 by TimEllershaw]