Need help setting up a questionaire website!

Lothar1974

Golden Member
Mar 24, 2003
1,133
0
76
I want to setup a website so some one can add their contact info and check a yes or no box to a question. And be able to track the info and results! I have Front Page 03 but I am not sure it is possible on it? Looking for any ideas that are hopefully not to complicated! Thanks!!!!!!!!


Lothar!
 

mechBgon

Super Moderator<br>Elite Member
Oct 31, 1999
30,699
1
0
This topic probably fits the Programming forum best, so it's being relocated from Computer Help to Programming where you should find some good help :)

AnandTech Moderator
mechBgon
 

Furor

Golden Member
Mar 31, 2001
1,895
0
0
The easiest way to do it is probably to create a mailform (google for it) that emails you the results.

The best way, and a bit more difficult is to use a server side scripting language and store the results in a database (you can probably find a simple php/mysql example of something similar online)
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
The e-mail form method works, but I personally don't like it at all.

You'll need a very basic amount of some scripting language (e.g. Perl or PHP) to write this. It should be literally 20 lines of code or so (whether you use a database or just a text file to store the results). If you can be more specific we can probably help you write it.
 

Lothar1974

Golden Member
Mar 24, 2003
1,133
0
76
ESUN: Thanks!

Trying to help a buddy that's totally computer illiterate!
He's trying to start up a part time company but wants to send out fliers first to see if people are interested. The flier will have a website address they can go to and fill out their name, address, phone number and check yes or no if they would be interested.

Basically look like this:


Would you be interseted in .......

Name:
Address:
Phone:
Email:

Yes __ No __


Thank you for .......


Any help is appreciated!!!!!!!!!!!!!!!!!!!

Jason
 

milehigh

Senior member
Nov 1, 1999
951
0
76
For something that simple you can use a simple Access DB with ASP.

create customers.mdb

create table called customers
create fields called 'name' and 'email'

create form.asp that has a form and post it to insert.asp

<form method=post action=insert.asp>
Name: <input name=name>....
Email: <input email=email>....
<input type="submit">
</form>


create insert.asp (this collects the posted form info and writes the values to the database)

dbcConn= "Enter the connection string to your database here"

Set rsCustomer = Server.CreateObject ("adodb.recordset")
rsCustomer.open "orderTbl",dbcConn, adOpenKeyset, adLockPessimistic, adCmdTable
rsCustomer.AddNew
rsCustomer("name") = request.form("name")
rsCustomer("email") = request.form("email")
rsCustomer.update

rsCustomer.close
set rsCustomer=nothing
dbcConn.Close
Set dbcConn = Nothing

Display text that record was updated.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
I don't see how using Access and ASP is easier than MySQL and Perl/PHP. Plus, this should depend on whether the OP's friend is using this on a Windows host or a *NIX host (the latter of which is probably more likely).

Lothar, the way this works is there are two files that must be created: the HTML file (which displays the form), and the Perl/PHP file (which takes the data from the form and puts it into a database or somewhere else--for this, I'd say a text file would be fine). If you want to use a database, you'll also need to create one, but again I think it's absolutely unnecessary for a script this simple. Incidentally, the HTMl file and Perl/PHP file can be combined into one, so let me write that up real quick.

Put this on your webserver somewhere and give it an extension of cgi (e.g. "form.cgi"):

Here's a link to the source that's properly formatted:

http://eudean.com/form.txt

--------------------------------------------------------

#!/usr/bin/perl

use CGI;
my $cgi = new CGI;

print $cgi->header;
print <<END;
<html><head><title>Information Form</title></head>
<body>
END

my $file = "records.txt";

if ($cgi->param('submit')) {
if (-s $file > 100000000) {
print "Too many records.";
} else {
open(FH, ">>$file");
print FH join("\n", "Name: " . $cgi->param('name'), "Address: " . $cgi->param('address'), "Phone: " . $cgi->param('phone'), "E-mail: " . $cgi->param('email'), "Interest: " . $cgi->param('interest')) . "\n\n";
close(FH);
chmod 0700, $file;
print "Thank you for responding. If you've expressed interest, we may contact you in the future.";
}
} else {
my $url = $cgi->url(-relative=>1);
print <<END;
<form action="$url" method="POST">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></input></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></input></td></tr>
<tr><td>Phone:</td><td><input type="text" name="phone"></input></td></tr>
<tr><td>E-mail:</td><td>input type="text" name="email"></input></td></tr>
<tr><td>Are you interested in ...?</td><input type="radio" name="interest" value="Yes">Yes</input> <input type="radio" name="interest" value="No">No</input></td></tr>
</table>
<input type="submit" name="submit" value="Submit"></input> <input type="reset" value="Reset"></input>
END
}

print "</body></html>";

------------------------------------------------------------

You may have to chmod the file to be executable (you can do this typing "chmod 755 form.cgi" at the command prompt, or if you're using FTP, you can probably right-click the file and set all of the executable permissions to "on").

Whenever someone submits this form, a new entry will be made in a file called "records.txt". You can just download this file through FTP and look at it to see who's responded. For a small application like this, I feel this is more convenient than a database. I've set a filesize limit on the file to about 10MB, so if you're expecting a lot of responses (as in hundreds of thousands), you may increase that size.