I got it, I think:

and this at the beginning of file "B"
$selected == "$selected";

and placed this statement in file "A"

if (isset($selected[$cat])) 
{
include ("cat_select.php"); 
} 

I don't know why it works but it does, is there anything wrong with this method?


Gerry wrote:
> 
> I hope you understand:
> 
> It is too long to include here so I'll give you an idea.
> 
> file.B
> -----------------------
> <?php
> $all_cats = "1, 2, 3";
> function html_options($output,
>                                         $values = NULL,
>                                         $selected = NOT_NULL,
>                                         $first_option_output = false)
> }
> return($html_output);
> }
> 
> echo"<select name=\"cat\" size=\"1\">";
> //-cats
> $cats = explode(',',$all_cats);
> //--values
> $cats_vals = explode(',',$all_cats);
> print html_options($cats, $cats_vals, $selected, "--Select one--");
> echo"</SELECT>";
> ?>
> ------------------------
> 
> file.A code:
> <?php
> $connect to db;
> $get result;
> $cat = $row["cat"];
> $selected = "$cat";
> -----------------------
> include ("file.B");
> -----------------------
> done
> ?>
> From here on I get the menu with --select one-- option first then 1, 2,
> 3, but it ignores the fact the I told it $selected = "$cat". I figure it
> has to do with including the function file instead of having the
> function inside of "A". How can I call file.B from different files and
> have it accept the variable $selected from such files?
> 
> Thaks in advance:
> 
> Gerry Figueroa
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to