jakebur01 Posted February 21, 2008 Share Posted February 21, 2008 i am posting the following data , should i add trim() around them and add backslashes? they are being posted to the page where i am checking all the fields before storing the data. $username = $_POST["username"]; $email = $_POST["email"]; $pass1 = $_POST["pass1"]; $pass2 = $_POST["pass2"]; $secure = $_POST["secure"]; $agree = $_POST["agree"]; Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/ Share on other sites More sharing options...
quincewyss Posted February 21, 2008 Share Posted February 21, 2008 I've always used single quotes on $_POST i.e. $forCount = $_POST['fc']; hope this helps! Quince Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473143 Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Before storing the values into mysql, use mysql_real_escape_string(). It will add any necessary slashes. $email = mysql_real_escape_string($_POST["email"]); Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473144 Share on other sites More sharing options...
jakebur01 Posted February 21, 2008 Author Share Posted February 21, 2008 thanks, should i use single or double quotes with $_POST? Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473150 Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Both will work. I too tend to use single quotes for array keys. Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473155 Share on other sites More sharing options...
kenrbnsn Posted February 21, 2008 Share Posted February 21, 2008 It doesn't matter if the index is a static string (single quotes are a little faster than double quotes). Ken Quote Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473157 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.