Page 1 of 1

[SOLVED] value not getting passed to function variable

Posted: Sat Mar 06, 2004 11:03 pm
by drmsolutions
Hi there,

I'm passing values to a function, but am finding the value of 'highlight_id' below is not set. I'm only new to PHP so am thinking I've done something wrong, but can't work out what?

Code: Select all

<? enhanced_list_box(array(
 'table'        => 'ctitle',
 'id_field'     => 'id',
 'value_field'  => 'title',
 'highlight_id' => $Resultset['Title']));
?>

$Resultset['Title'] definitely has a value, as I've printed it to test, but 'highlight_id' has not been set to the same value as $Resultset['Title'].
$Resultset['Title'] is set further up in the script:

Code: Select all

$Resultset = $MyDb->f_GetRecord($Result);
I actually got this script from someone else and they originally set 'highlight_id' => 4
I'm changing it as I want the listbox to select the value that is contained in the record it has retrieved rather than a static value.
I hope that makes sense?

Posted: Sun Mar 07, 2004 12:21 pm
by JAM
Before continuing, did you notice that you missed out a ' before the first table' posted above?

Posted: Sun Mar 07, 2004 2:32 pm
by drmsolutions
oops...sorry...have fixed it now...
It was in my original code, just didn't come over in the copy and paste.
Thanks...

Unfortunately that wasn't the problem :(

Posted: Mon Mar 08, 2004 6:40 am
by drmsolutions
Its all fixed now. The variable was losing scope in the fuction, so I used a GLOBAL variable and its working now!