note 119431 added to filter.filters.sanitize

From: Date: Fri, 03 Jun 2016 14:59:26 +0000
Subject: note 119431 added to filter.filters.sanitize
Groups: php.notes 
Request: Send a blank email to php-notes+get-205657@lists.php.net to get a copy of this message
This is an example for a form having a group of checkboxes besides a lot of other inputs: $args = array( 'details' => array( 'name' => 'details[]', 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_ARRAY ) // , // a lot of other stuff here (all the form’s elements) ); $myInputs = filter_input_array( INPUT_GET, $args, true ); where the checkboxes are (their form is in a page that reloads itself): <label> <input type="checkbox" name="details[]" value=“A” <?php if (in_array( “A”, $myInputs['details'] )) { echo 'checked'; } ?>> Show A </label> <label> <input type="checkbox" name="details[]" value=“B” <?php if (in_array( “B”, $myInputs['details'] )) { echo 'checked'; } ?>> Show B </label> <label> <input type="checkbox" name="details[]" value=“C” <?php if (in_array( “C”, $myInputs['details'] )) { echo 'checked'; } ?>> Show C </label> <label> <input type="checkbox" name="details[]" value=“D” <?php if (in_array( “D”, $myInputs['details'] )) { echo 'checked'; } ?>> Show D </label> ---- Server IP: 72.52.91.14 Probable Submitter: 87.238.22.162 ---- Manual Page -- http://php.net/manual/en/filter.filters.sanitize.php Edit -- https://master.php.net/note/edit/119431 Del: integrated -- https://master.php.net/note/delete/119431/integrated Del: useless -- https://master.php.net/note/delete/119431/useless Del: bad code -- https://master.php.net/note/delete/119431/bad+code Del: spam -- https://master.php.net/note/delete/119431/spam Del: non-english -- https://master.php.net/note/delete/119431/non-english Del: in docs -- https://master.php.net/note/delete/119431/in+docs Del: other reasons-- https://master.php.net/note/delete/119431 Reject -- https://master.php.net/note/reject/119431 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205657) next »