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? Quote 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; } ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.