View Full Version : Immediate form problem
igneous
Jun 7th 2006, 9:53 am
I started a new site recently, and it include a short form, which only has 5 fields. I am using it with dreamhost, so I just used formmail to process the form, as I thought it would be easy to take the results from my email to an excel file. Well, I ended up getting about 1500 people to fill out the form in the past couple days, and have too much to process. I basically want to find the simplest way to take form results and just put them into a database. I want it so I can take the results off the database and store them easily on excel. I just started looking at phpFormGenerator, but Im not sure if this is my easiest option. Any quick suggestions? thanks :)
sketch
Jun 7th 2006, 11:20 am
If I'm reading this correctly, you want to save your form submissions into a database so you can export the database to an Excel file? I would just save them straight to the Excel file.
You can either whip up some quick code to save a simple CSV (comma-separated values) file which you can open in Excel or look around for web scripts that'll export full-out Excel files. You can then have your script append every new submission to the end or beginning of the file.
igneous
Jun 7th 2006, 11:51 am
I was just looking at my database stuff, and dreamhost provides me with phpmyadmin, which from what I can see can export the database into excel, word, csv, or xml. So I guess that should be all set. I just am not sure how to create a form so it puts it into this database.
igneous
Jun 7th 2006, 3:00 pm
I think I actually figured it out. Heres my PHP code that my form posts to, the only thing i am not sure how to do is make the form to go to a thanks page or an imcomplete page if they missed a field.
<?php
@extract($_POST);
if(is_writable('emails.csv'))
{
$fp = fopen('emails.csv','a');
$content = "$firstname,$lastname,$email,$zip,$conf\n";
fwrite($fp,$content);
fclose($fp);
}
else
{
echo'File is not writable';
}
?>
sketch
Jun 7th 2006, 6:09 pm
To have it go to a page after executing code, use header("Location: domain.com/thanks.html"); and make sure to exit; the line after to show the correct URL (unless you don't want that :) ). Or simply use the echo command to output your message.
igneous
Jun 7th 2006, 6:34 pm
Thanks, I'm not quite sure where that fits in the code though. I've tried a bunch of different spots and I keep getting errors such as:
Warning: Cannot modify header information - headers already sent by...
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.