Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whitespace issues? 1

Status
Not open for further replies.

cyberspace

Technical User
Aug 19, 2005
968
GB
I have several user-updatable text areas in a system i am developing.

An issue i have noticed is that whenever it is updated, extra spaces are entered before the string starts so it's gradually moving accross the box.

This has gotten worse (i think) since i entered code to prevent issues with special characters such as ' being entered by the user.

What is it that i need to do to overcome this? a code example for escaping special characters:

Code:
$var_special = $_POST['whatever'];
$var = mysql_real_escape_string($var_special);

thanks :)

'When all else fails.......read the manual'
 
Sheesh, I have so much to learn!

I don't think i'm doing too badly since i've not done a great deal of PHP :)

that worked a treat - however - there is still one space (but at least it doesnt increase every time you update!)

How can i get rid of that first space?

'When all else fails.......read the manual'
 
trim will get rid of it unless it isbeing inserted by your code rather than the variable

eg
Code:
<textarea> <?=$variable?></textarea>
note the prepended space
 
thanks!

'When all else fails.......read the manual'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top