Page 1 of 1

Dynamic PHP/MySql Text Update

Posted: Mon Aug 07, 2006 3:28 pm
by richo
Hi,

I want the user to be able to use a textarea (also displaying the current data from a row inside it) and edit the text, click submit and it update the table column.

I also want to know if this will detect breaks/ new paragraphs or if there will be something i need to add to get it to do this.

Any help, much appreciated.

thanks.

Posted: Mon Aug 07, 2006 3:36 pm
by feyd
Handling the textarea submission is standard form handling. PHP nor MySQL will detect the breaks or paragraphs; they just don't care. You will need things like nl2br() to make the text more like what the user will likely expect to see.

Posted: Mon Aug 07, 2006 3:48 pm
by Christopher
As feyd said, characters like newlines and tabs will be saved in the database field and retrieved when you fetch that row. The upside is that the text is formatted as person entered it when you reload. A downside is that if you ever want to export to tab/other delimited then you will need to remember to strip out those characters.

Posted: Tue Aug 08, 2006 2:23 pm
by richo
Cheers guys. I asked some of my friends and they said i could do it with a REPLACE as part of the mySQL statement that adds it to the table.

thanks for your help,

Richo