Every thing after a space is truncated

I wrote a script to save records in a mysql database and that seems to work fine, but now I am trying to edit the records and when I get a record and display in in a form, it is only displaying the text up to the first space. Here is a snippet of my code. What is wrong?

Phone:

/>
</tr>  

I have tried “$phone” and ‘$phone’ both. If the number is (202)555-5555 it works fine. If the number is (202) 555-5555, all I see is (202)

My guess is this would have to do something on how your database table is setup? You probably don’t have enough characters? Or it might have to have something to do with your formatting somewhere else in the code? Just a few possibilities? I would show more of your code if you want to get a more detail possible solution.

Thanks for replying. The phone field is 20 characters long so, that’s not a problem. When you look at the phone number using phpmyadmin the complete phone number is there. The code below shows how I am getting the phone number. I put the “echo $phone” there to debug the program and the complete phone number does print on the screen. But only eveyrthing up to the first space shows up in the phone text input. This happens with all text fields, not just the phone field.

$phone=mysql_result($result,$i,phone);
echo $phone;
?>



Phone:



<input type=“text” name=“phone” value=<?php echo "$phone";?> />

If this is your actual code
[php]<input type=“text” name=“phone” value=<?php echo "$phone";?> /> [/php]
Then you are missing the “double quotes” on the value of the input. Should be
[php]<input type=“text” name=“phone” value="<?php echo "$phone";?>" /> [/php]
Also there is no need to encapsulate the $phone on that line in double quotes just to echo the var. This will suffice
[php] [/php]

Thank you very much fastol. That fixed my problem. Now I just need to write some code to update the database and other piece of code to delete a record and I will have a working database. I don’t think the last two programs should be hard to do. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service