Calling a function that resides elsewhere

From: Date: Thu, 12 Apr 2001 00:55:29 +0000
Subject: Calling a function that resides elsewhere
Groups: php.general 
Request: Send a blank email to php-general+get-48205@lists.php.net to get a copy of this message
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

« previous php.general (#48205) next »