Forum Moderators: coopster
checked="checked"
The shorter way will work but it's not valid HTML anymore.
Another tip is to enclose HTML strings in single quotes. That way there is no need to escape all the doubles. Here's an example:
<?php
$box1 = ' checked="checked"'; // notice the use of the quotes
echo '<input type="checkbox" name="tdm"$box1>'; // same deal with quotes here
?>
Remember though, that you will need to escape the single quotes in the same way you did your doubles. But there should be many less.
$tdm = $_REQUEST['tdm'];
$obj = $_REQUEST['obj'];
$ctf = $_REQUEST['ctf'];
$sql="UPDATE users SET tdm = '$tdm', obj = '$obj', ctf = '$ctf' WHERE username = '$me'";
tdm, obj, ctf are the names of the checkboxes that are passed onto this form. If the boxes are checked then there are no errors but data is not inserted into the DB, if they are not checked then i get Undefined index errors
Can anyone help?