Forum Moderators: coopster
I've developed a PHP based survey for my website that has been spread out over five pages.
As the person presses next, the portion of the survey they have just filled out is emailed to a special email address. When the person presses next on the 2nd page, part two of the survey then gets emailed. This has been setup this way so in-case someone doesnt finish all their survey, then at least some of their information has still been gathered.
The end result is a mailbox that has five emails per person that must be matched up by IP address, and then printed, and all the totals counted by hand.
What I think would be ideal would be the content that has been gathered from the survey is then sent to a script that can process this information, that can then output both the totals or the full information of any specific sample.
Is this possible? And how would I being something like this?
Thanks
1) Create a session for each visitor
2) Save all form informations in Database for that session
and then would create simple reporting page, by telling code to group form results on Session_ID you stored, you can get any repots you want, easily.
counts,questions filled,yes,no,this n that, everything.
you can process emails using php by setting up an alias in your mail config:
#emailuser: "¦/path/to/email_process.php"
this pipes all the mails to the php processing script. you then have to parse the mails, separate the headers and bodies and get the info you need. search for 'php parse email"
hth
Then, you can write another script to sort through the results, pull out the stats/results you need and email them to you. Or set it up so that the results are emailed to you when the user finishes the survery.
You could also set up a cronjob to fetch the results every day/hour if you don't want them emailed right away.
It looks like writing to a database is a move in the right direction. I've never done anything like this before, so hopefully I'll explore a wonderful new world that could open up new possibilities for me in the future!
One question about session ids. I was taking a look at PHP's site, and they said that session ids are either passed through a cookie (which might make users wary) or through the url (which is not search engine friendly). Could I not just use some variable unique to them (something like an IP address) and just use that?
Thanks
So, I'm building my MySQL database (or trying to) when I read in the help files that I can only have a maximum of 50 simultaneous connections. Now, right now I'm not getting that, but I'm wondering if this might be an Achilles heel to scalability. Does this number seem high/low/just right?
I did a similar questionnaire over 8 pages, and I used a hidden variable 'username' on each page which was passed onto the next. I used username to identify each respondent.
Ask them to enter a username on the first page, then include this on each subsequent page as a hidden variable
<input type="hidden" name="username" value=<?=$username?>>
In the PHP of each subsequent page, you can call the username variable like this:
$username = $_REQUEST['username'];
I would also recommend storing the data in a database (e.g. MySQL) rather than using e-mail.