GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 16-Nov-2006, 09:33
batalia batalia is offline
Awaiting Email Confirmation
 
Join Date: Oct 2006
Posts: 20
batalia is on a distinguished road

PHP question


I finished my survey and its working fine but I have a problem with survey results page. What I need is to show all results each time some one takes the survey and saves it to a text file. Right now it just adds 1 to each question taken. Also I want each selection on diffrent lines. I want it to show what each person selects that takes the survey. Here is the survey link and the code for the php file. Hope someone can help.

student.cse.fau.edu



PHP Code:

<?php
if(@$_COOKIE['websurvey'])
{
    
die("<br/>You will be able to return in 24 hours");
}
else
{
    extract($_POST);
    setcookie("websurvey",$username,time()+86400);
    setcookie("time",time()+86400);
}
?>

<html>
<head>
<title>Web survey PHP file</title>
</head



<?php
extract($_POST);
$fptr=fopen("data.txt","r+b");

$line=fgets($fptr);

$answer = split(",",$line,10);
if($q0 =="yes")
{
    $answer[0]+=1;
    
}

elseif($q0=="No")
{
    $answer[0]-=1;

}
else
;

if($q1=="yes")
{
    $answer[1]+=1;
    

}
elseif($q1 =="no")
{
    $answer[1]-=1;
    
}
else
;


if($q2=="yes")
{
    $answer[2]+=1;
}
elseif($q2 =="no")
{
    $answer[2]-=1;
}
else
;


if($q3=="yes")
{
    $answer[3]+=1;
}
elseif($q3 =="no")
{
    $answer[3]-=1;
}
else
;


if($q4=="yes")
{
    $answer[4]+=1;
}
elseif($q4 =="no")
{
    $answer[4]-=1;
}
else
;


if($q5=="yes")
{
    $answer[5]+=1;
}
elseif($q5 =="no")
{
    $answer[5]-=1;
}
else
;


if($q6=="yes")
{
    $answer[6]+=1;
}
elseif($q6 =="no")
{
    $answer[6]-=1;
}
else
;


if($q7=="yes")
{
    $answer[7]+=1;
}
elseif($q7 =="no")
{
    $answer[7]-=1;
}
else
;


if($q8=="yes")
{
    $answer[8]+=1;
}
elseif($q8 =="no")
{
    $answer[8]-=1;
}
else
;

if($q9=="yes")
{
    $answer[9]+=1;
}
elseif($q9 =="no")
{
    $answer[9]-=1;
}
else
;





rewind($fptr);
$line=join(",",$answer);

fwrite($fptr,$line);
fclose($fptr);

print("<h3>Survey results;$line<h3>");
?>

</body>
</html>
Last edited by LuciWiz : 16-Nov-2006 at 09:36. Reason: Please insert your Php code between [php] & [/php] tags
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP - sizes and generation times cable_guy_67 MySQL / PHP Forum 3 29-Sep-2005 09:26
Question about loading php into tables or css pcxgamer Web Design Forum 6 17-Sep-2005 22:08
Help ! I need help starting up on Php ! onauc MySQL / PHP Forum 11 05-Jan-2005 00:57
Grouping data from MySQL with PHP - Newbie question. giobbi MySQL / PHP Forum 12 27-Feb-2004 01:34
PHP Sessions question JdS MySQL / PHP Forum 2 16-Jul-2002 05:58

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:29.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.