ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

In search of ... a way to kill tabs

(1/2) > >>

barney:
OK, this one seems a bit stupid ... I seem to do a lot of those, don't I :(?

I'm in process of rebuilding a box that crashed.  Part of that rebuilding involves rewriting segments of PHP code that were lost.  Mostly, that's going well, but there's one problem that seems unresolvable. 

This script uses MySQL as part of the record keeping.  But whenever I try to populate an HTML textarea from a text column in the tables, it's always prefaced by either five (5) or six (6) tab characters.  None of the trim() functions are effective.  I can find many Google references to adding tabbing capability, but none, so far, to eradicating them.  I've checked - and rebuilt - the tables with several different versions of MySQL, even tried different versions of PHP.  The PHP SQL is simple -


--- Code: PHP ---select NoteContent from notes where NoteKey=n$notes=trim($notes)insert into notes (NoteContent) values (\$note\")orupdate notes set NoteContent=\"$note\" where NoteKey=n I left out some of the script, the if/then/else structures, but what's there is the relevant stuff.  The textarea bit is just

--- ---<... type=textarea ...><php? echo $note ?></textarea>But every time, the textarea shows the text with leading tabs, tabs that do not exist in the table's text field.  Oh, yeah, it's not browser-specific.  I've tried FF 3.x, FF 6, IE9, Safari, Opera, all with the same result.  These tabs are pulling my cork - something that seems easily accomplished, lately -and I've run out of places to look for an answer, save for DC.

Anybody got any ideas?

hamradio:
Should $notes=trim($notes) be $note=trim($note);?

barney:
Yeah ... I was ad-libbing that, not copy-and-pasting.  Way too much code to paste, anyway.  However, the actual PHP is correct in terms of spelling - one of my favorite errors is typos or a missing ),}," or ;, so I keep a list of all vars in a separate document, and compare frequently.  However, typos won't account for the prefacing tabs in three (3) textarea constructs.  For what it's worth, I've had a friend check my code, and she doesn't find anything erroneous - apart from a few of the aforementioned typos  :P. 

Due to time constraints, I'm trying not to rewrite this thing from scratch, have mostly succeeded, save for this one problem.

hamradio:
Could maybe try...


--- ---$note = str_replace("\t","",$note);

barney:
OK, I had tried

--- ---$studentnote=trim($studentnote,"\t")without success, both with and without the "\t" element.  When I tried

--- ---$studentnote=str_replace("\t","",$studentnote)I lost the note altogether, although the tabs were still there  >:(.

I think I've tried every replacement function in the PHP docs, w/o success  :mad:.

As Yul Brynner once said, "Is a puzzlement."

Navigation

[0] Message Index

[#] Next page

Go to full version