PHP Arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Niko
Forum Newbie
Posts: 9
Joined: Tue Apr 20, 2004 6:17 am

PHP Arrays

Post 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?
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post 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?
Last edited by Wayne on Tue Nov 09, 2004 5:02 am, edited 2 times in total.
Niko
Forum Newbie
Posts: 9
Joined: Tue Apr 20, 2004 6:17 am

PHP Array

Post by Niko »

Im after adding the code string as an element in the array
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post 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));
Niko
Forum Newbie
Posts: 9
Joined: Tue Apr 20, 2004 6:17 am

PHP Array

Post by Niko »

Thanks Wayne,

chanpion
Post Reply