• 0

PHP and MySQL form


Question

Hi, I have a website that is running (http://gaboue.is-a-geek.com/) and when I read a news from the MySQL database, all "enter" that have been entered are not showned and replaced by space, except if you do a <br>.

This website is going to be used by non-computer geek user so I wish to know if there is a way to correct this enter bug. Thanks.

BTW, I'm running mysql 4

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Have you tried throwing the output from the sql query through the nl2br() function in php? Or if that doesn't work, you could always do it when you insert the text into the database, ensuring that your <br> tags are correctly inserted...

Link to comment
Share on other sites

  • 0
I mean, I don't want the user to use the tag <br>. It work with the <br> tag, but I want that the "enter" key input enter just as this forum do.

That's exactly what nl2br() does - it takes the text you enter (complete with new lines from a text box) and outputs the text with those newline characters changed to <br> tags - which is what you want to happen - then you output that to the screen and voila!

Link to comment
Share on other sites

  • 0

oh! ok thanks, but I found out to find another problem but not on the output but the input. I'm using the post/get form action method 'cause I dunno how to use php_var yet (so I had to activate "register_global") but there is a problem in the input. If the user want to put some ' or \, he need to put the escape char \, like to say 'cause, I would put \'cause. Else, the query failed to execute. I don't very know how to change that.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.