如何屏蔽$ _POST [template_id]?
<?php
$dbcon = mysql_connect('localhost', 'xxx', 'xxx') or
exit(mysql_error());
mysql_select_db('xxx', $dbcon) or exit(mysql_error());
function your_filter($value) {
$newVal = trim($value);
$newVal = mysql_real_escape_string($newVal);
return $newVal;
}
foreach($_POST as $key => $value) {
$_POST[$key] = your_filter($value);
}
?>
<form action='' method='post'>
<input type='checkbox' class='flat' name='template_id[]' value='"2'>A<br>
<input type='checkbox' class='flat' name='template_id[]' value='3'>B<br>
<input type='text' class='flat' name='das' value='"test'> b<br>
<input type='submit'>
</form>