Jaguar Posted June 20, 2007 Share Posted June 20, 2007 What should I insert as the default value if a form field is blank? My fields don't currently accept null. if($_POST['height']) { // error checking $height = $_POST['height']; } else { $height = ''; } Should $height be equal to '', NULL, or maybe 'NULL'? I'm thinking 'NULL' incase I or someone else decides to change the field to accept null? Link to comment https://forums.phpfreaks.com/topic/56408-default-value-to-insert-into-mysql/ Share on other sites More sharing options...
Caesar Posted June 20, 2007 Share Posted June 20, 2007 <?php function check_value($myvalue) { if((!isset($_POST['.$myvalue.'])) | ($myvalue == '')) { $myvalue = ''; } else { $myvalue = $clean->clean_input($_POST['.$myvalue.']); } return $myvalue; } ?> Link to comment https://forums.phpfreaks.com/topic/56408-default-value-to-insert-into-mysql/#findComment-278599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.