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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print field with spaces

Status
Not open for further replies.

murushanmugham

IS-IT--Management
Jan 2, 2003
33
0
0
Hello

How do I print a field on screen with spaces.
I use mysql
my field is like
marks =" Theory 50 100 "



please help
 
You have a couple of options:

1. Wrap it in pre tags:
Code:
echo '<pre>' . $row['marks'] . '</pre>';

2. Put it in an element with a pre style:
Code:
echo '<div style="white-space: pre;">' . $row['marks'] . '</div>';

3. Change the spaces to [ignore]&nbsp;[/ignore]:
Code:
echo str_replace (" ", "&nbsp;", $row['marks']);
 
I need to display the contents of the field as it is.

The field is like
marks =" Theory 50 100 "



i use print$ marks.

When i display this on the screen i get output as

Theory 50 100

i need output as
Theory 50 100

bye
 
Have you tried any of the options I gave you? All of them will output what you want. If you need to be guided, switch $row['marks'] with $marks in every code. If you prefer, you can also switch echo's with prints.
 
Thank you very much

The first code usig pre is working fine

bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top