Hallo alle zusammen,
für meine Diplomarbeit muß ich eine Umfrage machen, und da die meisten Betriebe die zu befragen sind sich im Ausland befinden bot sich eine online Umfrage an. Ist ja kein Problem, radio buttons & co waren mir ja bekannt, ebenso das dazu gehörende PHP script. Nur eie Anforderung hatte mein Formular nicht: Die antworten (optionen) müssen sich bei jedem Neuladen nach dem Zufalssprinzip neu anordnen. Selbst das läuft jetzt recht zufriedenstellend, da ich ein ähnliches Script gefunden habe das ich anpassen konnte. Nun sitz ich hier also mit meinem Fragebogen, und meinen nach Zufallsprinzip angeordneten Antwortmöglichkeiten, und kann dessen Variablen nicht auslesen (denn i muss die Daten ja irgendwie sammeln.) Kann mir da jemand mal einen Schubs in die richtige Richtung geben?
Der Fragebogen in seine jetzigen Version ist hier zu finden:
www.lewerken.com/survey/survey4.html
Gruß,
Florian
Anlage:
hier ist der Quellcode der HTML Datei
<HTML> <HEAD>
<SCRIPT LANGAUGE="JavaScript"> <!--
// This object holds question info function oAnswer(qnum, anum, text, rflag) { this.qnum = qnum; this.anum = anum; this.text = text; this.rflag = rflag; }
// Takes an array and returns it in randomized order function makeRandom(aOrder) { var num = aOrder.length - 1;
for(var i = num; i >= 0; --i) { if(! aOrder[i].rflag) continue;
var randNum = Math.round(Math.random() * i);
if(aOrder[randNum].rflag && (i != randNum)) { // move selected item to back of array // these will no longer be selectable var temp = aOrder[i]; aOrder[i] = aOrder[randNum]; aOrder[randNum] = temp; } } return aOrder; }
// Calls the randomizing function, and returns a string // which formats the answers for display. function showAnswer(aAnswers, numCorrect) { var string = ''; var aRandomized = makeRandom(aAnswers);
for (i in aRandomized) { if (aRandomized[i].anum != 0) { string += '<tr><td valign=top><INPUT TYPE="'; if (numCorrect > 1) { string += 'checkbox'; } else { string += 'radio'; } string += '" NAME="UserAnswer_'; string += aRandomized[i].qnum + '"'; string += ' VALUE="' + aRandomized[i].anum + '">'; string += '\n \n'; string += '</td>'; string += '<td valign=top>'; string += aRandomized[i].text + '</td></TR>'; } } return string; }
//--> </SCRIPT>
<STYLE TYPE="text/css"> <!-- BODY {font-family: Arial, sans-serif} FONT {font-family: Arial, sans-serif} A {font-family: Arial, sans-serif} P {font-family: Arial, sans-serif} TABLE {font-family: Arial, sans-serif} TR {font-family: Arial, sans-serif} TD {font-family: Arial, sans-serif} UL {font-family: Arial, sans-serif} OL {font-family: Arial, sans-serif} DL {font-family: Arial, sans-serif} H1 {font-family: Arial, sans-serif} H2 {font-family: Arial, sans-serif} H3 {font-family: Arial, sans-serif} H4 {font-family: Arial, sans-serif} H5 {font-family: Arial, sans-serif} H6 {font-family: Arial, sans-serif} --> </STYLE></HEAD>
<BODY MARGINWIDTH="0" MARGINHEIGHT="0" TOPMARGIN="0" LEFTMARGIN="0" LINK="#000066" VLINK="#666666"
<FORM method=POST action="/scripts/survey.php"> <input type=hidden name="Betreff" value="Feedback Formular"> <DIV ID="div_entire_page"> <table width="700" cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td><FONT FACE="arial" SIZE="-1"> <B> Business Software Development - Theory and Practice</B></font><BR>
<FONT FACE="arial" COLOR="#8989DB" SIZE="+2">Quantitative Survey</FONT></td> </tr> <tr> <td height="15"></td> </tr> <tr> <td> <p align="justify">Dear Sir or Madam,</p> <p align="justify">Thank you very much for taken the time to fill out this survey. We are currently researching innovation management in business software vendors and would like to get some insights on the involvement of different departments with the creation process.</p> <p align="justify">All data will be handled confidentially and will only be used to create some general industry wide statistics. No individual company data will be used throughout the process.</p> <p align="justify">Thank you for your co-operation.</p> <p align="justify">Grzegorz Bilinski<br>G. Ph. Florian Lewerken<br>Kishan Ramkisoensing</p> <p> </p> <P>
</td> </tr> </table>
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" width="700" align="center">
<TR> <TD VALIGN="TOP"><FONT FACE="arial" SIZE="+1"><NOBR>1 .</NOBR></TD> <TD VALIGN="TOP"> </TD>
<TD VALIGN="TOP"><FONT FACE="arial"> Please state the name of the company you are currently working for <P> <input type="text" size="50" name="name" width="100"> <BR> <BR> </TD> </TR>
<TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/blind.gif" height="11" width="580"></TD> </TR> <TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/line_grey.gif" height="1" width="700"></TD> </TR> <TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/blind.gif" height="11" width="580"></TD> </TR> <TR> <TD VALIGN="TOP"><FONT FACE="arial" SIZE="+1"><NOBR>2 .</NOBR></TD> <TD VALIGN="TOP"> </TD>
<TD VALIGN="TOP"><FONT FACE="arial"> Please enter your email-address. This address will be used when submitting your answers and serves as a mean of validation. Adresses will only be stored temporarily. <P> <input type="text" size="50" name="email" width="100"> <BR> <BR> </TD> </TR>
<TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/blind.gif" height="11" width="580"></TD> </TR> <TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/line_grey.gif" height="1" width="700"></TD> </TR> <TR> <TD COLSPAN="3" align="center"><img SRC="/grafiken/blind.gif" height="11" width="580"></TD> </TR> <TR> <TD VALIGN="TOP"><FONT FACE="arial" SIZE="+1"><NOBR>3 .</NOBR></TD> <TD VALIGN="TOP"> </TD>
<TD VALIGN="TOP"><FONT FACE="arial"> Which department do you currently work for? <P>
<SCRIPT LANGUAGE="JavaScript"> <!-- var ans = new Array(); // the 0th element is just a placeholder document.write('<table border=0 cellspacing=0 cellpadding=2>');
ans[0] = new oAnswer(10, 0, '', false);
ans[1] = new oAnswer(10, 1, 'Accounting', true);
ans[2] = new oAnswer(10, 2, 'Sales', true);
ans[3] = new oAnswer(10, 3, 'Consultancy', true);
ans[4] = new oAnswer(10, 4, 'Research and Development', true);
ans[5] = new oAnswer(10, 5, 'Marketing', true);
ans[6] = new oAnswer(10, 6, 'Management', true);
ans[7] = new oAnswer(10, 7, 'Other', true); document.write(showAnswer(ans, 1)); document.write('</table>');
// --> </SCRIPT>
<BR> <BR> </TD> </TR>
<TR> <TD COLSPAN="3" align="center"><FONT FACE="arial"><I><NOBR></NOBR></I></FONT> </TD> </TR><TR><TD VALIGN="TOP" COLSPAN="3"><P>
<INPUT TYPE="submit" VALUE="Submit Anwers"> <INPUT TYPE=RESET VALUE="Clear Answers / Start Over"> <BR> <BR> </TD> </TR> </TABLE> </FORM> </BODY> </HTML>
Und hier der Quellcode der PHP Datei die Datei auslesen soll
<html>
<head> <title>Survey Results</title> </head> <body> <? if ($name == "" || $email == "") { echo"<font face=Verdana color='#000000' size=2>Please fill you companies name. Hit back to go back.; <p>Vielen Dank. <p><a href="JavaScript:history.go(-1)"><img src="../grafiken/pfeil_gr.gif" alt="zur vorigen Seite" border="0"></a> </p>"; } else { if (ereg("^([a-zA-Z0-9._-]+)@([a-zA-Z0-9.-]+.[A-Za-z][A-Za-z]+)$", $email)) { $to="napperkt@kiebitzberg.de"; $subject="Survey Feedback V0.5"; $message="Data Collected: \n company: $name \n email adress: $email \n department $UserAnswer_\n department $UserAnswer_10"; $header="From: $email\n"; mail ($to, $subject, $message, $header ); echo"<div align=left> <table border=0 width=480 cellpadding=2> <tr> <td width='100%'><font face=Verdana color='#000000'><b>Survey successfully send. </b></font><p> <p><font face=Verdana size=2 color='#000000'>Thank you very much for participating in this survey.<br> <br> <p>Grzegorz Bilinski<br>G. Ph. Florian Lewerken<br>Kishan Ramkisoensing </font>"; } else { echo"<font face=Verdana color='#000000' size=2>You didn't supply a valid email adress. Please check your responses and try again. <p><a href="JavaScript:history.go(-1)"><img src="../grafiken/pfeil_gr.gif" alt="zur vorigen Seite" border="0"></a> </p>"; } } ?> </td></tr> <tr><td> </td></tr> </table> </div> </body>
</html>