Welcome to Dream.In.Code
Become a PHP Expert!

Join 149,882 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,333 people online right now. Registration is fast and FREE... Join Now!




how to create a survey

 
Reply to this topicStart new topic

how to create a survey

tork
17 Dec, 2006 - 01:48 PM
Post #1

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 20


My Contributions
I am after a survey that asks users how they came upon my site. I understand how to build and use forms, but how do I store a users information that has completed the form so that they cannot ever undertake the survey again?
User is offlineProfile CardPM
+Quote Post

tork
RE: How To Create A Survey
17 Dec, 2006 - 02:07 PM
Post #2

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 20


My Contributions
would I use cookies to store a users information on the web server? I haven't used cookies in PHP, only sessions..

QUOTE(tork @ 17 Dec, 2006 - 02:48 PM) *

I am after a survey that asks users how they came upon my site. I understand how to build and use forms, but how do I store a users information that has completed the form so that they cannot ever undertake the survey again?


User is offlineProfile CardPM
+Quote Post

snoj
RE: How To Create A Survey
17 Dec, 2006 - 02:17 PM
Post #3

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Cookies are stored on the user's machine, so no. Cookies are used to "remember" a user and since they are from the user, you can't trust them to always be there.

Basically cookies are used to bypass something that requires a user for input, like a username and password at a forum, so you don't have to type it in each time you visit.
User is offlineProfile CardPM
+Quote Post

tork
RE: How To Create A Survey
17 Dec, 2006 - 03:17 PM
Post #4

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 20


My Contributions
i was not certain if you could record user information, like in cookies, on the web servr. So the question remains, what information do I gather from a user input to stop them from undertaking in the survey again? form would look like this:

CODE

<form action="page.php" method="post">
<p>
  <input name="radiobutton" type="radio" value="radiobutton" />
  Search Engine
</p>
<p>
  <input name="radiobutton" type="radio" value="radiobutton" />
  Link
</p>
<p>
  <input name="radiobutton" type="radio" value="radiobutton" />
  Email
</p>
<p>
  <input name="radiobutton" type="radio" value="radiobutton" />
  Word of Mouth
</p>
<p>
  <input type="submit" name="Submit" value="Submit" />
</p>
</form>


Thanks..!
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: How To Create A Survey
17 Dec, 2006 - 03:24 PM
Post #5

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,293



Thanked: 101 times
Dream Kudos: 1275
My Contributions
If you only want your sites members to be able to vote then use a mysql table to insert their member number with their vote and check if their member number already exists in the given poll before allowing them to vote again.

If you want to allow everyone and anyone tovote add their IP address to a mysql table with their vote and check their IP against the records before allowing them to vote again. The only problem with this is that IPs change given time, or if they re-boot their machine. So you will also want to use cookies, but don't rely solely on cookies as anyone can delete them and be allowed to vote numerous times.

Sessions won't work for a poll because all they would need to do is close all their internet pages and re-open them to be able to vote again.
User is offlineProfile CardPM
+Quote Post

tork
RE: How To Create A Survey
17 Dec, 2006 - 03:38 PM
Post #6

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 20


My Contributions
I had thought about putting IP address into a mysql database, but i know that IP addresses change as ISPs can give users different IP addresses, or something like that. anyway, they change, sometimes twice in a day, so it's not sufficient unfortunately. I would like to be able to allow everyone to submit an answer to the survey and not just members. So it begs the question, is there any unique information that a user brings to a website that does not change over a period of time. I think that maybe this might be a tricky one if a user is not a member.

QUOTE(BetaWar @ 17 Dec, 2006 - 04:24 PM) *

If you only want your sites members to be able to vote then use a mysql table to insert their member number with their vote and check if their member number already exists in the given poll before allowing them to vote again.

If you want to allow everyone and anyone tovote add their IP address to a mysql table with their vote and check their IP against the records before allowing them to vote again. The only problem with this is that IPs change given time, or if they re-boot their machine. So you will also want to use cookies, but don't rely solely on cookies as anyone can delete them and be allowed to vote numerous times.

Sessions won't work for a poll because all they would need to do is close all their internet pages and re-open them to be able to vote again.


User is offlineProfile CardPM
+Quote Post

snoj
RE: How To Create A Survey
17 Dec, 2006 - 03:44 PM
Post #7

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
No, there is no way to definitively identify a user expect with a username and password.
User is offlineProfile CardPM
+Quote Post

tork
RE: How To Create A Survey
17 Dec, 2006 - 03:47 PM
Post #8

New D.I.C Head
*

Joined: 14 Dec, 2006
Posts: 20


My Contributions
how often does an IP address change then?
User is offlineProfile CardPM
+Quote Post

snoj
RE: How To Create A Survey
17 Dec, 2006 - 04:04 PM
Post #9

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Depends on the carrier and type of connection mainly. With highspeed types like DSL or cable, the ISP generally lets the customer keep the same IP address for extended periods of times.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:59AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month