Display a specific $$key value set in a foreach loop ...

I’m looping through a form post to set a variable for each field and clean them. Pretty sure the below is functioning as I wish.

[php]<?php
foreach($_POST as $key=>$value){
$value=htmlentities(stripslashes(strip_tags($value)));
$$key = trim($value);
}
?>[/php]

Later down the page I need to display a specific field. I could just display the post variable:
echo $_POST[“admin_phone”];
But I want to display the cleaned version I set in the foreach loop. Either my loop isn’t working, or I’m an idiot and can’t find the correct syntax to make that happen.

Be kind - Coldfusion is my main language and some PHP stuff just befuddles my mind so far!

Ok, found it. I SWEAR this wasn’t working before

<?php echo $admin_phone; ?>

I’m an idiot. I admit it.

I'm an idiot. I admit it.

easy, Its part of programming it happens a lot.

Sponsor our Newsletter | Privacy Policy | Terms of Service