checkbox issue

[php]

<?php if(isset($_POST['formSubmit'])){ if( $_POST['formWheelchair'] == 'Yes'){ echo "Need wheelchair access."; } else { echo "Do not Need wheelchair access."; } } ?>[/php]

[code]

Do you need wheelchair access? [/code]

the problem is, in case of “yes” its works fine but in case of “No” it it gives error

Notice: Undefined index: formWheelchair in C:\xampp\htdocs\hello.php on line 5
Do not Need wheelchair access.

You need to initialize variable first before you use it, php does not know that yes has not been checked so it does not know if its yes or no it is in limbo then with null.
If we add the var before we need it, so the var is here but do not put a value to it is does not grumble.

Add above if(isset

[php]$formWheelchair = ‘’;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service