Sunday, April 3, 2011

JQuery - web form to mysql via php - textfield not formatting correctly.

Can anybody suggest the best way of keeping the formatting intact of a text field - ie. keeping the line breaks or carriage returns in mysql and then recognising them when the form is populated on login?

Currently when the textfield data is stored (in a TEXT field in mysql) its losing the carriage return values and adding a small square box instead.

Would it be a case of formatting with nl2br or using a str_replace instead?

Thanks

From stackoverflow
  • The square box is likely just not having the character set to show the paragraph marker (¶) that MySQL wants to show in place of carriage returns.

    You should be able to pull the data back out of MySQL into a textarea to confirm that the data is being stored properly.

  • This is not a jQuery issue. The $_POST should come with the correct breaks included.

  • I solved my own problem. It wasn't a jQuery issue but I wasn't addressing the posted variable in the correct way.

    Elzo Valugi : what did I say?

0 comments:

Post a Comment