eurob Posted December 29, 2007 Share Posted December 29, 2007 part of my html <form action="process.php" method="post"> Check box field: <input name="showit[]" type="checkbox" value="whatever"> <input type="submit"> //process.php <?php $showit = $_POST['showit'] ?> If I don't check the check box I get the error 'undefined index'. How can I still capture the check box value, regardless if I checked it or not? Thanks, robert Link to comment https://forums.phpfreaks.com/topic/83550-check-box-question/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 29, 2007 Share Posted December 29, 2007 process.php <?php if ( isset($_POST['showit']) ) { $showit = $_POST['showit'] } Undefined index is only a notice, nothing fatal. You can ignore those, but if you want to program correctly, you need to test if a variable exists before working with it directly. PhREEEk Link to comment https://forums.phpfreaks.com/topic/83550-check-box-question/#findComment-425104 Share on other sites More sharing options...
eurob Posted December 30, 2007 Author Share Posted December 30, 2007 Thanks Link to comment https://forums.phpfreaks.com/topic/83550-check-box-question/#findComment-425683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.