eramge11 Posted February 12, 2016 Share Posted February 12, 2016 Hello everyone! I have a code that is for a phone number entry. The code works fine however, it will automatically fill "0" in the spot for the phone number if it is null. This is throwing our system off for numbers. If you can see what may be causing this, I would appreciate it. <div class="row"> <div class="row-left"> <?php echo $form->labelEx($info,'student_mobile_no'); ?> <?php echo $form->textField($info,'student_mobile_no',array('size'=>12,'maxlength'=>12)); ?><span class="status"> </span><br/><br/><b style="color:red;"> <?php echo $form->error($info,'student_mobile_no'); ?></b> </div> Quote Link to comment https://forums.phpfreaks.com/topic/300795-phone-number-displays-0-as-defult/ Share on other sites More sharing options...
requinix Posted February 12, 2016 Share Posted February 12, 2016 Are you storing the phone number in your database as a string or as a number? Hint: it should be a string. Quote Link to comment https://forums.phpfreaks.com/topic/300795-phone-number-displays-0-as-defult/#findComment-1531038 Share on other sites More sharing options...
eramge11 Posted February 12, 2016 Author Share Posted February 12, 2016 When you type them in to the database they save just fine however, if you don't enter a phone number into the database then it will automatically put a "0" in the database. They are saved into an SQL area. Quote Link to comment https://forums.phpfreaks.com/topic/300795-phone-number-displays-0-as-defult/#findComment-1531039 Share on other sites More sharing options...
requinix Posted February 12, 2016 Share Posted February 12, 2016 Cool. Are you storing them as strings or numbers? Or to be more clear, is the data type for the column in the table a string type or a number type? 1 Quote Link to comment https://forums.phpfreaks.com/topic/300795-phone-number-displays-0-as-defult/#findComment-1531040 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.