maltrecho
01-24-2004, 12:23 PM
Having the following example, I'm getting all messages correctly when the function isn't called but, why can't I get the messages inside the function when the function is called but I'm still retrieving correctly the variable and the rest of the messages outside the function? What am I doing wrong?
/* my_functions.php */
/* START FUNCTIONS */
function my_function($var,$mess) {
if (bla bla bla) {
do this to $var;
$mess[] = "bla bla bla";
return $var;
} else {
$mess[] = "bla bla bla";
}
/* END FUNCTIONS */
/* my_page.php */
include('my_functions.php');
/*START VALIDATION */
if (bla bla bla) {
do this;
$message[] = "bla bla bla";
} else {
$message[] = "bla bla bla";
}
if (bla bla bla) {
my_function($variable,$message);
$message[] = "bla bla bla";
} else {
$message[] = "bla bla bla";
}
/* END VALIDATION - START OUTPUT */
for ($i = 0; $i < count($message); $i++) {
echo $message[$i];
}
/* END OUTPUT */
Thanks to all.
/* my_functions.php */
/* START FUNCTIONS */
function my_function($var,$mess) {
if (bla bla bla) {
do this to $var;
$mess[] = "bla bla bla";
return $var;
} else {
$mess[] = "bla bla bla";
}
/* END FUNCTIONS */
/* my_page.php */
include('my_functions.php');
/*START VALIDATION */
if (bla bla bla) {
do this;
$message[] = "bla bla bla";
} else {
$message[] = "bla bla bla";
}
if (bla bla bla) {
my_function($variable,$message);
$message[] = "bla bla bla";
} else {
$message[] = "bla bla bla";
}
/* END VALIDATION - START OUTPUT */
for ($i = 0; $i < count($message); $i++) {
echo $message[$i];
}
/* END OUTPUT */
Thanks to all.