0

I have an ad's website. There need to enter add description some more and telephone number. The telephone number starts 0, like 07780046 but after saving add appears without 0 is like 7780046. Any idea what's wrong?

Script for filling form:

        <tr>
            <td valign="top"><b>Telefono nr.</b></td>
            <td><input name="telephone" type="telephone" id="telephone" size="30" maxlength="13" value=""></td>
        </tr>

and script output. Add page:

    <?php if($ad['telephone']){ ?>
<b><?php echo "Telephone n."; ?></b>: 
<?php echo $ad['telephone']; ?>

Thank you for your time.

1 Answers1

0

Save the telephone number as a string. I doubt you will want to do any math operations on it.

If you want to validate your phone numbers check out the answer below:

A comprehensive regex for phone number validation

Community
  • 1
  • 1
otherDewi
  • 1,098
  • 10
  • 24