SkyRanger Posted April 27, 2007 Share Posted April 27, 2007 I am having a problem when a user type "word" mysql like to cut off everything after the first " how can I make it so mysql will insert the whole like ie: first "word" here instead of cutting off at first? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 27, 2007 Share Posted April 27, 2007 Please post the code you're using between tags. Ken Quote Link to comment Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 a) addslashes() b) htmlentities() <-- prolly better for this... Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 Ok this is what is happening. Users are typeing things in text boxes like: From: <input type=\"text\" name=\"fname\"> value = Firstname "Nick" Lastname or To: <input type=\"text\" name=\"tname\"> value = Firstname "Nick" Lastname I tried doing: $fromname = addslashes($fname); and $toname = addslashes($tname); With no luck I honestly do not know how to properly use this code. Doing google search as I type for more info. Quote Link to comment Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 http://us2.php.net/manual/en/function.htmlentities.php Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 Thanks taith, I am learning alot from that link you gave me, fixed 90% of my problems. Quote Link to comment Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 LOL! it fixes 90% of user input problems ;-) Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 lol, Just realized I need stripslashes,addslashes and htmlentities() now it works 100%. Thanks for the help. Quote Link to comment 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.