I have series of checkboxes whom value I am taking and generating a string like….if checkbox is selected I add ‘1’ to string and if it is not selected I add ‘0’ to string.
<input type="checkbox" name="auth_0" id="auth_0" class="checkboxes" value="Yes"/>
My php script is…
if (isset($_REQUEST["save"])) {
/* echo $_REQUEST['auth_0'];*/
for ($i = 0; $i <= 49; $i++) {
if ($_REQUEST['auth_[$i]'] == 'Yes') {
$auth_string .= '1';
} else {
$auth_string .= '0';
}
}
echo $auth_string;
}
Though string is generating but its value is always 0 in both cases that if checkbox is selected or not.
using
'tells PHP to not parse/interpolate variable values inside the string. use"instead.