Page 1 of 1

Sanity check: function return

Posted: Mon Jun 16, 2008 12:40 pm
by zachrose
Hi all, I'm building my first php app. It's a one-page CMS for a one-page website for a guy who has a small business.

I'm debugging all my code. I have an escape_data function that I copied out of a book and is not working. So I've been paring down the function and it's still not working. Here's it is at the minimum:

Code: Select all

function escape_data ($data) {
    return ($data);
    }
 
//Validate and clean data
 
echo (escape_data($_POST['message']));
 
What's weird is that

Code: Select all

echo ($_POST['message']);
is working just fine.

Is there something wrong with how I'm structuring my function?

Re: Sanity check: function return

Posted: Mon Jun 16, 2008 12:44 pm
by John Cartwright
what does

Code: Select all

var_dump($_POST['message']);
echo '<br />';
var_dump(escape_data($_POST['message']));
result in?

Re: Sanity check: function return

Posted: Mon Jun 16, 2008 12:47 pm
by Dj_Lord
post all the function, because

Code: Select all

echo (escape_data("<b>aaa/a</b>"));
is working well.

maybe there is a syntax error?

Re: Sanity check: function return

Posted: Mon Jun 16, 2008 4:15 pm
by Ambush Commander
Place this at the top of your file: error_reporting(E_ALL). Does anything pop up?