Sanity check: function return

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zachrose
Forum Newbie
Posts: 5
Joined: Mon Jun 16, 2008 12:34 pm

Sanity check: function return

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Sanity check: function return

Post by John Cartwright »

what does

Code: Select all

var_dump($_POST['message']);
echo '<br />';
var_dump(escape_data($_POST['message']));
result in?
Dj_Lord
Forum Newbie
Posts: 6
Joined: Mon Jun 16, 2008 11:51 am

Re: Sanity check: function return

Post 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?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Sanity check: function return

Post by Ambush Commander »

Place this at the top of your file: error_reporting(E_ALL). Does anything pop up?
Post Reply