How to get sized integer from form input

22 views
Skip to first unread message

Troy Hall

unread,
Jul 19, 2016, 1:58:33 PM7/19/16
to joomla-dev-general
I'm trying to make sure that the user enters a proper size integer into a form which will be read by post.
I see
$foo = $jinput->get('varname', 'default_value', 'filter');
but I'm not sure exactly how that would be used with post data.

My current code is :
<label class="control-label" for="yearSelector">Year</label>
<input class="col-md-3 form-control input-sm" id="yearSelector" name="yearSelector" type="text" />

then its read with :
if ($_POST['yearSelector']) { $year = $db->quoteName('Year') . ' = ' . $db->quote($_POST['yearSelector']) . ' AND '; }

One of the big problems is the year must be in YYYY format and day ( for example ) must be 03 not 3

I'm sure this is basic stuff but I appreciate your help
Bear

Viper

unread,
Jul 20, 2016, 11:22:05 AM7/20/16
to Joomla! General Development
Reply all
Reply to author
Forward
0 new messages