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"]; 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 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"]); 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? 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. 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 Link to comment https://forums.phpfreaks.com/topic/92345-backslashes-or-no-backslashes/#findComment-473157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.