PDA

View Full Version : PHP Help.



RyanS
16-09-2006, 07:55 PM
I am quite good at PHP Normally but this has stumped me.



$tutorial=$_REQUEST['tutorial'];
$title=$_REQUEST['title'];
$category=$_REQUEST['category'];
$desc=$_REQUEST['description'];


How would i use the functions stripslashes AND htmlspecialchars on each one?

Splinter
16-09-2006, 08:02 PM
use this..


foreach($_REQUEST as $key=>$val) {
$$key = stripslashes(htmlspecialchars($val, ENT_QUOTES));
}

this will work..

RyanS
16-09-2006, 08:03 PM
So i just put that in the PHP File?

Splinter
16-09-2006, 08:06 PM
yes instead of the code you used and it will produce the same variables..

RyanS
16-09-2006, 08:08 PM
Oh so i actually replace the bit i posted with that?

Recursion
16-09-2006, 09:01 PM
yes. .

Want to hide these adverts? Register an account for free!