Forum Moderators: coopster
Only one DB field is affected by the problem
“biz_name” varchar 50, keep in mind the number cause it matters.
Since I am testing a retesting the new site I edit and submit many times
Obviously biz_name does not need any edit BUT
Any times I edit any other field (but not biz_name) and click on submit biz_name got automatically one white space added in the DB in front of BizName and if my biz_name is say 47 long after 4 submits I will miss the last letter
(50-4=46) and there goes my 47th letter out of BizName value initially 47 letters long, another submit and I will lose another one.
I looked at it through PHPmyAdmin and found that the title position moved with each submit to the right of the PHPmyAdmind field
For ex:
Before: BizName
After a few hits....... BizNa (used dots, I cannot create white space on the forum)
What’s happening here?
Sorry for the long post
Regards
Henry
I used the same formula many times and never had that glitch
Check the value of business_name when it is received:
$business_name =$_POST['business_name']; echo str_replace(" ","-",$business_name)."<br />\n"; exit; (Since this is a test, I used
exit to stop the routine before it ran the update query.) Replacing any spaces with dashes before echoing the variable's value should let you see what's happening with the extra spaces.
For a quick fix, use this in your upddate query:
business_name ='ltrim($business_name)', ltrim() will remove any whitespace at the start of the string, so they won't keep adding up.
and
business_name ='ltrim($business_name)',
does not work it goes in the DB as: "ltrim (mybiz)"
exactly as it appears between the " "
however (mybiz) is the correct name to pass by business_name
and yes the other non affected fields are TEXTAREA
exactly CC of this other textarea field that cause problem, although the last textarea do work fine!
<TEXTAREA COLS=80 ROWS=1 NAME="business_name" WRAP=VIRTUAL>
<? print $s[business_name];?></TEXTAREA>
Don't know how you may be handling the data before you store it, but the problem may be there. You will need to undo any changes you made prior to stroing the data into DB before you display it again.
Try replacing the above with <? print trim($s[business_name]);?>
WBF