I was able to get the return to work but not the pass in the reference. One last question, what if I want to have each item on a separate line like:
function cleaner($var) { trim($var); strip_tags($var); ucfirst($var); addslashes($var); str_replace ("$","",$var); } $var = "abc's"; echo $var; How would I return the results here, I tried various different ways none of them worked? On 6/29/06, Chris <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote: > I am trying to create a function to clean up variables that are user > inputted from a form. I am not getting this script to work. Can anyone > help. > > ---Start Script--- > function cleaner($var) > { > trim(strip_tags(ucfirst(addslashes($var)))); > } > > $var = "abc's"; > > echo $var; You need to return the value from the function: return trim(strip_tags(.....) or pass in a reference: function cleaner (&$var) -- Postgresql & php tutorials http://www.designmagick.com/
-- ********************************************************************** The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. *********************************************************************