SalientAnimal Posted August 23, 2012 Share Posted August 23, 2012 Hi All, My question is pretty basic, how do I use ucfirst when submitting a form to the Table? I have tried the following: ,'$_POST ucfirst[fname] $_POST ucfirst[lname]' And ,'$_POST [ucfirst(fname)] $_POST [ucfirst(lname)]' Thanks Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/ Share on other sites More sharing options...
trq Posted August 23, 2012 Share Posted August 23, 2012 The code you have posted makes no sense. You pass your values to ucfirst as an argument. eg; ucfirst($_POST['fname']); Having said that, why are you modifying user submitted data? And secondly, your not using user submitted data directory in your queries are you? Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1371764 Share on other sites More sharing options...
SalientAnimal Posted August 24, 2012 Author Share Posted August 24, 2012 This is just part of my registration page. All I'm wanting to do with the information is Capitalise the first letter of their first name and last name, so when I do personalised mailers it will just look neater. Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372057 Share on other sites More sharing options...
SalientAnimal Posted August 24, 2012 Author Share Posted August 24, 2012 Sorry I probably should of also mentioned that the code I posted is part of the SQL Query where I am doing a INSERT INTO VALUES ('$_POST ucfirst[fname] $_POST ucfirst[lname]') Hence why the code looks the way it does Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372072 Share on other sites More sharing options...
trq Posted August 24, 2012 Share Posted August 24, 2012 As I said. Placing user input into a query like that is a major security concern. Don't do it. You need to validate and sanitise *all* input used within database queries. Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372076 Share on other sites More sharing options...
fenway Posted August 26, 2012 Share Posted August 26, 2012 More importantly, never combine first and last names into a single column. Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372577 Share on other sites More sharing options...
Zane Posted August 26, 2012 Share Posted August 26, 2012 What everyone is getting as is that you should not modify the information before you put it in the database. Although, you DO need to sanitize it before hand. Wait until you take the information out from the database to modify its look and feel. Otherwise, it would be like pouring milk into a cereal box, and then putting it in the cabinet so you don?t have to add milk later. Be normal and pour the milk in afterwards. Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372583 Share on other sites More sharing options...
fenway Posted August 26, 2012 Share Posted August 26, 2012 Yeah, and soggy corn flakes are disgusting. Quote Link to comment https://forums.phpfreaks.com/topic/267467-using-ucfirst-when-submitting-to-mysql-database/#findComment-1372735 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.