Tim
Tim

Reputation: 17

Phone Number not echoing fully in HTML Form

I'm simply echoing a user's info in an HTML form as "value=". Everything is working perfectly except the phone number. Here is my current code:

 <div class="sign-in-btn">
            <input type="phoneNumber" data-mask="(000) 000-0000" name='User_phonenumber' id='User_phonenumber' value=<?php echo $phone;?> />
          </div>

Only the area code appears - ie (908). The phone number is formatted in the db as (xxx) xxx-xxxx.

I feel it has something to do with the form because it echos perfectly when done outside the form. For example, the full number (with formatting) echos perfectly in this :

<h3 class="sign-in-header">Your phone number is <?php echo $phone;?> </h3>

Steps I've taken:

  1. removed "type" in the form attributes - no success
  2. removed "data-type" in the form - no success
  3. echoed $phone in other form fields (first name, etc) - same issue.

Any ideas guys and gals?!

Thanks!!

Upvotes: 0

Views: 127

Answers (1)

Gert
Gert

Reputation: 370

your problem is here this

value=<?php echo $phone;?>

should be

value="<?php echo $phone;?>"

you forgot the quotes

Upvotes: 4

Related Questions