473,799 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you echo a long space

1 New Member
Hello,

I'm doing some PHP and MySQL, and have a very simple question.

How do you echo a long space? When I use echo " ": , it gets echo'd as only one space...

Using echo " "; echo " "; echo " "; doesn't help either.

Thanks in advance for answering :).

2Dcube

EDIT: what's funny is that every long space i typed here, got reduced to a single one as well... it's supposed to be: "____" that long..
May 14 '07 #1
3 29774
Lick
3 New Member
This isn't a PHP problem, it's an HTML problem. By default the browsers eat away the whitespaces that come after the first whitespace. You can replace the whitespace by " " (without quotes) which the browser will recognize as a space.

You could also set the CSS property "whitespace " to "pre" for the containing element. That will stop the browser from eating whitespaces.
May 14 '07 #2
Display informat as u write
<?
if($_POST['ok'])
{

$om=$_POST[t];
//$om=nl2br($om);
$new_string = str_replace(' ', '&nbsp;',$om) ;
echo nl2br($new_stri ng);
}
?>
<form method="post">

<textarea name="t"></textarea>
<input type="submit" name="ok">
</form>
Oct 17 '10 #3
I think the answer from @ Lick is on target, and I just wanted to add a suggestion .. to write a long space you should use

echo "&nbsp;&nbs p;";

or

echo"&nbsp;[space]&nbsp;"; to gain a longer space...

CMIIW
Oct 27 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2493
by: Nick Messick | last post by:
I have a multi step signup form that I'm building and I have the following question. Should I do it this way: <?php if (blah == 1) { ?><table><td width="100">........etc <?php } else { ?> <table><td width="100">........etc <?php } ?>
13
23262
by: Tony | last post by:
I'm just wondering why it seems most people use "echo" instead of "print". I tend to use "print", probably because I started programming in BASIC back in 78, so it's just familiar. Echo can take multiple expressions (as in "echo $string1,$string2,$string3"), which apparently is a bit faster than multiple concatenations. But for basic output, there doesn't seem to be a noticeable difference. The speed test at...
7
6809
by: Galina | last post by:
Hello I am going to copy a data from MS Access table into Oracle table. One of fields is memo type and data in this field range from 1 character to 551 long string. Do I need to create a field type LONG in the Oracle table to accommodate this data? If not, what field type would suit best? Any help will be greatly appreciated. Thank you. Galina
9
3423
by: Domestos | last post by:
Here an unusual one... Say i am writing a few lines of code in php script as so... <?php echo '<table>'; echo '<tr>'; echo '<td> blah blah </td>'; echo '</tr>'; echo '</table>';
9
2058
by: windandwaves | last post by:
Hi Folk My question is: echo all the time vs echo at the end - what is faster Let me explain I used to write pages like this: echo "<head> ";
7
4785
by: James o'konnor | last post by:
hello. i have the next for create one table into db2 CREATE TABLE "MYSQUEMA"."TABLADEMO" ( "ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +0 INCREMENT BY +1 MINVALUE +0 MAXVALUE +2147483647 NO CYCLE
11
5218
by: Neil | last post by:
I need to temporarily remove the recordset from my form while I run some queries (have locking problems). So I turned Echo off before removing the recordset to avoid getting #Name? in the bound controls. However, even though I turned Echo off, I'm still getting #Name? until I reset the recordset. Here's the code I'm using: DoCmd.Hourglass True Application.Echo False Me.RecordSource = "" <run queries here>
12
2036
by: Wolfgang Kaml | last post by:
Dear all, I am using the following code to retrieve the size of a certain file and the available (free) space on the disk. The problem is, that I get the size of the file returned as a Long and the size of free disk space as UInt64. Apparently, there are no function to convert a Long to a UInt64 or to compare the two (I'm not expecting to convert the UInt64 to a Long necessarily, but it should work the other way round, right?). Short...
3
1972
by: dhaval321 | last post by:
Hello guys, my code is like $temp="here there is space"; <INPUT maxLength=30 name="txtFirstName" size="28" class="txtNormal" tabindex="4" style="float: left" value=<?php echo $temp; ?>> But in a value of this textfield gives only "here" instead of "here there is space"....space is not been taken as a value..can anyone suggest me wht to do to eliminate this problem
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.