Jump to content


Photo

X--solved--Xusing auto new line in a form nl2br($club)


  • Please log in to reply
9 replies to this topic

#1 ludjer

ludjer
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts
  • LocationSouth Africa-Pretoria

Posted 31 August 2006 - 02:33 PM

i have a form that takes what ever the user put into it a database
i would like it that when the user puts a new line in (hits Enter)
that a br is placed there
bit while the guy is typing but when he hits submit

thx alot
:D

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 31 August 2006 - 02:37 PM

str_replace("bad_letter","</br>",$form_field_name);

please read up on str_replace and also eregi_repalce as they are used on php codes daily to modify information form a database and will also intrest you
as a learner ok.

good luck.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 31 August 2006 - 02:44 PM

don't use str_replace, use nl2br().

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 31 August 2006 - 02:47 PM

jenk can you kindly exsplin that syntex of nl2br() please and yes i have read on it but dont use it offthen.

can you kindly give an example and exspalin on the code cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 31 August 2006 - 02:49 PM

<?php

$text = "This 
is
some 
text";

echo nl2br($text);

?>

Will output:
This<br />
is<br />
some<br />
text

:)

#6 ludjer

ludjer
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts
  • LocationSouth Africa-Pretoria

Posted 31 August 2006 - 02:55 PM

dude thx alot i will try that now
:D

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 31 August 2006 - 02:55 PM

does that mean when a user press the enter button to make a new line when there adding some text to a form that nl2br makes the <Br/> happen.

and thank you so much cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 31 August 2006 - 02:56 PM

not instantly, but if you pass the data through nl2br on processing, yes it will.

#9 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 31 August 2006 - 02:58 PM

thank you

i get it know .
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#10 ludjer

ludjer
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts
  • LocationSouth Africa-Pretoria

Posted 31 August 2006 - 03:03 PM

ya it works thx alot
:D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users