Jump to content

Storing form input without a database?


soaknfused

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/213532-storing-form-input-without-a-database/
Share on other sites

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/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.