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
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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.