[PHP] Check box help!

Hi, I have a checkbox called check:


<input type="checkbox" name="check" value="1">

If it is check, I would like the virable $time to be “afternoon” and if its not checked, the virable to be “morning”.

This is what I have:


if($_POST['check'] == 1) { $time = afternoon} else { $time = morning}

This doesn’t seem to work, can anyone enlighten me to where I have gone wrong?