htmlentities

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
Jack88
Forum Newbie
Posts: 1
Joined: Mon Jun 14, 2010 12:22 am

htmlentities

Post by Jack88 »

Hi,
Having some problem understand why this code always prints a 1
basically I pull the information from a database and I would like to use htmlentities in case someone gets the reCAPTCHA code wrong
If they do get it wrong when the page refreshes it pulls their previous submitted resume from the database not what they have just entered
original code
<?php echo isset($update_array[17])?$update_array[17]:""; ?> working :)

The following code always prints a 1
as you can see I have even tried the trim function but it does not work still prints a 1

<?php echo isset($update_array[17])?print trim(htmlentities($_SESSION['aao'],"1")) : print ""; ?>

any ideas would be greatly appreciated

Kind Regards

Jack
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: htmlentities

Post by requinix »

Let's refactor that code a little bit:

Code: Select all

<?php if (isset($update_array[17])) {
    echo print trim(htmlentities($_SESSION['aao'],"1"));
} else {
    echo print "";
} ?>
Post Reply