Help witn an array

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 24, 2014   (RSS)

By Daryl - March 24, 2014

Hi nmsinc,

You can get the value of the text box as an array by exploding it and use in_array() function to check it against another field. For example:

$textBoxValuesAsArray = explode("\n", strip_tags($testRecord['text_box_field']));

$textColor = '';
if (in_array($testRecord['another_field'], textBoxValuesAsArray)){
   //set the text color to blue
   $textColor = "#0000FF";
}
else{
   //set the text color to black
   $textColor = "#000000";
}

Hope this helps!

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By nmsinc - March 24, 2014

Thanks Daryl - I will give it a try!

nmsin

nmsinc