Re: strings in a function return

From: Date: Thu, 30 Aug 2001 02:19:51 +0000
Subject: Re: strings in a function return
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-65153@lists.php.net to get a copy of this message
Im beginning to think that functions aren't all that cracked up to be. I may as well go back to my old "non function" way of coding. I was displaying the form in the function because the application Im using currently displays forms in functions. Ill try and see what I can do with this new found knowledge called 'functions'..... David Robley wrote:
On Thu, 30 Aug 2001 11:38, Gerard Samuel wrote:
top(); is a function that displays a menu, that works. <form> is where the form goes. In its current setup less the array/implode/explode/foreach loop I can get it to echo 'a' return that I specify. But its no good, when I have 7 seven fields in the form to process..... David Robley wrote:
On Thu, 30 Aug 2001 10:45, Gerard Samuel wrote:
Mozilla sucks sometimes with email formatting. Correction==> Here is a snippet example. function assign() {
        global $adminurl, $string;
        top();
        if ($string) {
                $data = explode ("|", $string);
                echo "$data[0]";
}
<form>
$array = array("$new_cat,$assigned_to","$job","$assigned_by");
$string = implode("|",$array); return $string;
} The variables that form $array are from the form....
Hrm - undefined function top() ?? <FORM> ?? But the rest of it returns what I would expect - a comma followed by two | - given that I don't have the values referenced in the array. And | you won't either, as they aren't global and aren't passed as parameters.
Why are you putting the form inside the function? There surely must be a better way to achieve what you want (which is not clear from the snippet).
.


« previous php.general (#65153) next »