cyandi_man Posted January 4, 2009 Share Posted January 4, 2009 Hi guys, i have a php form that pulls data from mySql database. for some reason this info is being truncated. ex. in the zipcode field only first 3 numbers show up and only the first part of the street address shows up. I do have that particular cell as VARCHAR on the database so that i can have both numbers and letters as data. do spaces in the data have anything to do with it? or should this be more of a question for a mySql forum? **also the text field on my php form is a large enough size to hold the data - so i doubt that is the issue anyway - it pulls in all the data even if it was not long enough wouldnt it? please advise - thanks! Quote Link to comment https://forums.phpfreaks.com/topic/139441-truncation-of-data/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2009 Share Posted January 4, 2009 It is probably how you are outputting the data to the browser. The most likely cause is invalid HTML due to no quotes around the value parameter in the form field. Code please? Quote Link to comment https://forums.phpfreaks.com/topic/139441-truncation-of-data/#findComment-729418 Share on other sites More sharing options...
fenway Posted January 5, 2009 Share Posted January 5, 2009 This is definitely bordering on php only... use print_r() and see if you're getting the expect values for the DB. Quote Link to comment https://forums.phpfreaks.com/topic/139441-truncation-of-data/#findComment-729736 Share on other sites More sharing options...
cyandi_man Posted January 5, 2009 Author Share Posted January 5, 2009 It is probably how you are outputting the data to the browser. The most likely cause is invalid HTML due to no quotes around the value parameter in the form field. Code please? the following is in the PHP file: while ($row = mysql_fetch_array($result)) { extract($row); echo "<div width='98%'> <table width='420px' style='float:left' class='topprofiletable'> <tr><td><b><font color='666666'>Family Member:</font></b> </td><td>$clientNumber </td></tr> <tr><td><b><font color='0000ff'>$firstName, $Minitial $lastName</font></b></td><td> <b>Gender:</b>$gender</td></tr> <tr><td style='float:left' class='item'>Street Address:</td><td style='float:right'><input type='text' name='streetad' value=$streetAddress></td></tr> <tr><td style='float:left' class='item'>City:</td><td style='float:right'><input type='text' name='city' value=$city></td></tr> <tr><td style='float:left' class='item'>Province:</td><td style='float:right'><input type='text' name='prov' value=$province></td></tr> <tr><td style='float:left' class='item'>Postal Code:</td><td style='float:right'><input type='text' name='postal' value=$postal></td></tr> <tr><td style='float:left' class='item'>Phone Number:</td><td style='float:right'><input type='text' name='phone' value=$Hphone></td></tr> <tr><td style='float:left' class='item'>Cell Number:</td><td style='float:right'><input type='text' name='cell' value=$Cphone></td></tr> <tr><td style='float:left' class='item'>Office Number:</td><td style='float:right'><input type='text' name='work' value=$Wphone></td></tr> <tr><td style='float:left' class='item'>Fax:</td><td style='float:right'><input type='text' name='fax' value=$Fax></td></tr> <tr><td style='float:left' class='item'>Email:</td><td style='float:right'><input type='text' name='email' value=$email></td></tr> </table> </div>"; } Quote Link to comment https://forums.phpfreaks.com/topic/139441-truncation-of-data/#findComment-730262 Share on other sites More sharing options...
PFMaBiSmAd Posted January 5, 2009 Share Posted January 5, 2009 How about fixing your code for what was already posted as the most likely problem - The most likely cause is invalid HTML due to no quotes around the value parameter in the form field. Also, any values echoed into form fields that could contain HTML entities (<, ', ", >...) should be passed through htmlentities so that those HTML entities don't break your web page. Quote Link to comment https://forums.phpfreaks.com/topic/139441-truncation-of-data/#findComment-730280 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.