Forums

User input garbage in form

Phil91 13 Oct, 2010
Hi Bob,

I have a stupid question: some sort of individual/robot/whatever recently entered crap twice in a form I use: this was essentially html code and url's although I use some user-input simple math check to verify the form...Is there a simple way to prevent html/url's in the form fields or am I just a little dreamer?

Thx for all hints you may have

Kenavo

Philippe
GreyHead 13 Oct, 2010
Hi Philippe,

You can filter the input in the onSubmit Before box
<?php
$input_name = JRequest::getString('input_name', 'default value', 'post');
JRequest:;setVar('input_name', $input_name);
?>
Instead of getString you can use getInt, getWord, getCmd, and a few others. Even the minimal getVar will do some filtering.

Bob
This topic is locked and no more replies can be posted.