Page 1 of 1

PHP Arrays

Posted: Tue Nov 09, 2004 4:45 am
by Niko
I have a strange problem with an array, i would like to add the following as a single element in an array.

$columnVal = array();
$columnVal[] = "((isset($HTTP_POST_VARS['firstname_sbd]') ? $HTTP_POST_VARS['firstname_sbd'] : null))";

However this causes the page to fail to load, however if you remove the ' from the post var, the page loads but the code dosnt work, eg
['firstname_sbd'] to [firstname_sbd]

Is there a way to add the string to the array?

Posted: Tue Nov 09, 2004 4:54 am
by Wayne
are you wanting to put that actual string value into the array or are you wanting the result of that statement into the array?

PHP Array

Posted: Tue Nov 09, 2004 4:59 am
by Niko
Im after adding the code string as an element in the array

Posted: Tue Nov 09, 2004 5:02 am
by Wayne
if you want the actual string use

Code: Select all

$columnVal = array(); 
$columnValї] = '((isset($HTTP_POST_VARSї"firstname_sbd"]) ? $HTTP_POST_VARSї"firstname_sbd"] : null))';
if you want the result of the statement use

Code: Select all

$columnVal = array(); 
$columnValї] = ((isset($HTTP_POST_VARSї'firstname_sbd']) ? $HTTP_POST_VARSї'firstname_sbd'] : null));

PHP Array

Posted: Tue Nov 09, 2004 5:07 am
by Niko
Thanks Wayne,

chanpion