soaknfused Posted September 16, 2010 Share Posted September 16, 2010 A quick intro: I'm new to web development...the end. I've been messing around with HTML forms and processing them via PHP. I have zero experience with databases and I don't have the time to learn it right now. I have a web based survey that my boss wanted me to try to develop, the problem is that it needed to be done a month ago. I've been working on it for about a week and I think it's good enough for now...but, without knowing how to store the form input in a database I'm coming up short on figuring out how to store the data. I was trying to write a simple .csv file to import into Excel but the form has textarea's and if a user sends a carriage return it completely breaks the csv format. I'm currently using fwrite($fp, "\"".$fields."\"".","); since I couldn't get fputcsv to work at all. This works great until it gets to the variable which contains the carriage returns which it passes to the csv file. You can see the form on my personal server at http://mbharris.com/scripts/nmas/nmas.php. The last page is just a page of echo commands to make sure the session variables are getting passed properly. If there is a better way of doing this (outside of a database) please let me know. I need to get this done! Thanks, Brad Quote Link to comment https://forums.phpfreaks.com/topic/213532-storing-form-input-without-a-database/ Share on other sites More sharing options...
purplemonkey Posted September 22, 2010 Share Posted September 22, 2010 Hi I'm pretty new to php/mysql myself. and so I'm not sure if this will work for you, but have you tried the php/sql string cleaning command. I use before storing variable data in the database, its suposed to clean up quotes etc, and not sure if it works on carrige returns, could be worth a try though. e.g. $cleanstring = mysql_real_escape_string($_POST['data']); http://ditio.net/2008/06/29/clean-input-variable-php/ Quote Link to comment https://forums.phpfreaks.com/topic/213532-storing-form-input-without-a-database/#findComment-1114017 Share on other sites More sharing options...
soaknfused Posted September 24, 2010 Author Share Posted September 24, 2010 I ended up storing the data as XML. I still have to figure out how to get it into a database though. I've had a little bit of success so far. Thanks for the help though. Quote Link to comment https://forums.phpfreaks.com/topic/213532-storing-form-input-without-a-database/#findComment-1115086 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.