Re: Calling a function that resides elsewhere

From: Date: Thu, 12 Apr 2001 01:15:31 +0000
Subject: Re: Calling a function that resides elsewhere
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48209@lists.php.net to get a copy of this message
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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#48209) next »