ethan6 Posted February 27, 2010 Share Posted February 27, 2010 Like this text box I'm writing in right now-- what should I use for users on my website to enter text on a forum on my website? I'm writing in PHP, and my database is in SQL. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/ Share on other sites More sharing options...
trq Posted February 27, 2010 Share Posted February 27, 2010 A textarea? Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1018851 Share on other sites More sharing options...
ethan6 Posted February 27, 2010 Author Share Posted February 27, 2010 Well see that's what I have, but then when I go to output the data that is saved in my database, any odd characters get all messed up.. or when they're entering data, if the user enters an ' (apostrophy) for example, it gives an error. Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1018853 Share on other sites More sharing options...
trq Posted February 27, 2010 Share Posted February 27, 2010 That is simply caused by not escaping special characters properly when you insert data into your queries. All user inputted data should go through mysql_real_escape_string before entering your database queries. Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1018855 Share on other sites More sharing options...
ethan6 Posted February 27, 2010 Author Share Posted February 27, 2010 ok thanks. how about formatting of the data that they enter? When i output it, i'd like it to preserve their paragraphs etc. Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1018861 Share on other sites More sharing options...
Alex Posted February 27, 2010 Share Posted February 27, 2010 For converting line breaks to html breaks use nl2br Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1018865 Share on other sites More sharing options...
ethan6 Posted February 27, 2010 Author Share Posted February 27, 2010 ok i see how the nl2br() converts \n to <br> , but what if my users just push return and don't enter code in? is there a way i can get a WYSIWYG editor so the people entering it don't have to enter code? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1019080 Share on other sites More sharing options...
greatstar00 Posted February 27, 2010 Share Posted February 27, 2010 then search on internet for wysiwyg, there are pretty much sample out there http://code.google.com/p/jwysiwyg/downloads/list Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1019083 Share on other sites More sharing options...
ethan6 Posted February 27, 2010 Author Share Posted February 27, 2010 ok thanks.. i'm working with the jWYSIWYG one,. but just wondering how i add a "submit" button? thanks Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1019088 Share on other sites More sharing options...
trq Posted February 28, 2010 Share Posted February 28, 2010 ok i see how the nl2br() converts \n to <br> , but what if my users just push return and don't enter code in? If a user hits enter it will be stored within the database as a newline. When you display this data on a page, running it through nl2br will covert the newlines to <br /> tags. i'm working with the jWYSIWYG one,. but just wondering how i add a "submit" button? That would have nothing to do with php and more to do with reading the manual of whatever WYSIWYG editor you are using. Quote Link to comment https://forums.phpfreaks.com/topic/193535-whats-a-good-way-for-users-to-enter-text-in-a-forum/#findComment-1019246 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.