variable content?

bojanv55
06-22-2002, 03:58 PM
when i post form to .php file, does my text in variable have ENTER sign, becouse when i post something like this:

BLA BLA

BLA BLA

i get something like this:

BLA BLA BLA BLA

instead of new line, i get 2 spaces. is this wrong to php, or to html?

ChiefRedBull
06-22-2002, 04:17 PM
This is because carriage return line feed (Enter or CRLF) in the text that you posted are real, character based sets. However, in HTML, the code for a CRLF is <BR>. So simply replace all instances of Chr$(10) & Chr$(13) with a <BR>.

Thinker
06-22-2002, 04:19 PM
Where are you seeing the BLA BLA BLA BLA? Are you just sending
the value of the variable back to the browser? What do the tags
look like where you include the textarea in the form?

bojanv55
06-23-2002, 08:54 AM
when i send variable $Komentar here it goes code for textbox


<p align="center">
<input type="text" name="email" size="38" maxlenght="18" tabindex="3"></font></p>
<p align="center"><font face="Verdana" size="1">&nbsp;<b>Komentar<font color="#FF0000">*</font></b> ( npr.
Vaše mišljenje o sajtu ) : <br>
<br>


and i put in text box something like

BLA BLA

BLA BLA

and then, i send it to this php file


<tr>\r\n");
fputs($fajl, " <font face=\"Verdana\" size=\"1\">\r\n");
fputs($fajl, " <td width=\"100%\"><font face=\"Verdana\" size=\"1\">$Komentar</font><br><br></td>\r\n");
fputs($fajl, " </font></tr>\r\n");
fputs($fajl, " </table>\r\n");
fputs($fajl, " </center>\r\n");


and then, my output is

BLA BLA BLA BLA

so , i don't have new line, how to do that, or i have to replace that char10 with <br>, and how to do that?

Thinker
06-23-2002, 06:08 PM
I could be very wrong, but I believe if you want multiline text
posted back you need to use a textarea. Something like...
<textarea name="email" rows="4" cols="20" wrap="hard" tabindex="3"></textarea>

ChiefRedBull
06-24-2002, 07:43 AM
Thinker is correct, an INPUT of type "TEXT" will not allow multilines. Why on earth would you want a multiline email address anyway? Ah, maybe you want them to enter more than one email? I see....

Ok, change from an INPUT to a TEXTAREA as Thinker suggested above, but I'm pretty sure you'll still need to replace all the CRLF characters with a "<BR>".

bojanv55
06-27-2002, 05:58 PM
what is code for changinf ENTER (character i dont know :)) to <br> ???

Thinker
06-27-2002, 10:42 PM
Look up the nl2br(string) function.

bojanv55
06-28-2002, 03:59 PM
thanks, i made it with str_replace command.

DrunkenHyena
07-01-2002, 09:57 PM
G'day!

You can use the nl2br function to translate newlines to <BR>'s.

echo nl2br($my_text);

Stay Casual,

Ken

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum