adam84 Posted August 14, 2007 Share Posted August 14, 2007 I was wondering if it will cause a problem if the user enters some text like: 'I got 100% on my test & 85% on my assignment. What did you get?' would the %, ? and & signs cause a problem with the data being sent? Is that a function that I should use to get around this...? Thanks Link to comment https://forums.phpfreaks.com/topic/64783-solved-sending-parameters/ Share on other sites More sharing options...
tomfmason Posted August 14, 2007 Share Posted August 14, 2007 You would want to use encodeURIComponent and/or encodeURI() Link to comment https://forums.phpfreaks.com/topic/64783-solved-sending-parameters/#findComment-323179 Share on other sites More sharing options...
adam84 Posted August 14, 2007 Author Share Posted August 14, 2007 if i use the encodeURIComponent() function, will i have to do anything special with php to decode the data? Link to comment https://forums.phpfreaks.com/topic/64783-solved-sending-parameters/#findComment-323186 Share on other sites More sharing options...
tomfmason Posted August 14, 2007 Share Posted August 14, 2007 yes urldecode(); Link to comment https://forums.phpfreaks.com/topic/64783-solved-sending-parameters/#findComment-323199 Share on other sites More sharing options...
adam84 Posted August 14, 2007 Author Share Posted August 14, 2007 Still no like. This is what is going in: Used PHP to write JS echo "Function validate(){" //i took out all the validation tests and stuff echo "sendRequest( encodeURI('insertTitle.php?title='+title), 'result' );"; echo "}" I enter the text '100% Me? & You' and submit it the url being passed is: insertTitle.php?title=100%25%20Me?%20&20You my php file to process the data <? $title = $_GET['title']; echo urldecode($title); ?> result of this is: 100% Me? Link to comment https://forums.phpfreaks.com/topic/64783-solved-sending-parameters/#findComment-323546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.