Forum Moderators: coopster
$question = $validateform->injection($Name) ¦¦ $validateform->injection($Organization)
¦¦ $validateform->injection($Address_1) ¦¦ $validateform->injection($Address_2) ¦¦ $validateform->injection($Town)
¦¦ $validateform->injection($Post_code); Problem is I am at present writing a form with a whole bunch of inputs - so the above sequence is going to look a bit massive writing it that way. I guess it will still work OK - but is there a more elegant way of writing the code?
foreach($_POST as $input) {
if(!$validateform->injection($input)) { #this depends on what the function returns if there is an injection found
echo 'Injection detected';
exit;
}}
This code, however, assumes that all post variables will be checked with this function. If you want to do it another way, you can use a similar technique, you just have to be more specific.