Menu
hi, everyone.
I am really newbie here about codes. I need someone here to help me how can I insert data generated by javascript into database?
I dying to gain help. below I attached my complete php and javascript file for your reference. I need to know any ideas about how can i save the result into database, Thank you and have nice day.
[ATTACH=CONFIG]16297[/ATTACH]
[ATTACH=CONFIG]16295[/ATTACH]
[canned-message]attachments-removed-during-migration
[code=php]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Learning Style Questionnaire</title>
<script language="JavaScript1.2" src="cuba.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="Questions">
<div id="Instructions">
<h1>Learning Style Questionnaire</h1>
<B> Instructions </B>
<p>Read each statement carefully. Answer honestly as there are no correct or incorrect answers.
It is best if you do not think about each question too long, as this could lead you to the wrong conclusion..</p>
<p></p>
</div> <!-- Instructions -->
<?php include 'db.php';
/*$question = mysql_query("SELECT * FROM tbl_ferquestion")
or die(mysql_error());
$row = mysql_fetch_array($question);
$answer1 = mysql_query("SELECT ans1 FROM tbl_ferquestion")
or die(mysql_error());
$ans1 = mysql_fetch_array($answer1);*/
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" align="center">
<caption><h2><b>Learning Styles Questionnaire</b></h2></caption>
<caption><h3><b>SECTION 1 (Doing & Watching)</b></h3></caption>
<tr>
<form name="Question1" id="Question1">
<tr><td class="question">1.
<input type="radio" value="radio0" name="radio" id="rad1-1"/>
<label for="radio1-1" class="radiobutton">I often produce off-the-cuff ideas that at first might seem silly or half-baked.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="rad1-2"/>
<label for="radio1-2" class="radiobutton">I am thorough and methodical.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question2" id="Question2">
<tr><td class="question">2.
<input type="radio" value="radio0" name="radio" id="rad2-1"/>
<label for="radio2-1" class="radiobutton"> I am normally the one who initiates conversations.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="rad2-2"/>
<label for="radio2-2" class="radiobutton"> I enjoy watching people.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question3" id="Question3">
<tr><td class="question">3.
<input type="radio" value="radio0" name="radio" id="radio3-1"/>
<label for="radio3-1" class="radiobutton"> I am flexible and open minded.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio3-2"/>
<label for="radio3-2" class="radiobutton"> I am careful and cautious.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question4" id="Question4">
<tr><td class="question">4.
<input type="radio" value="radio0" name="radio" id="radio4-1"/>
<label for="radio4-1" class="radiobutton"> I like to try new and different things without too much preparation.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio4-2"/>
<label for="radio4-2" class="radiobutton"> I investigate a new topic or process in depth before trying it.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question5" id="Question5">
<tr><td class="question">5.
<input type="radio" value="radio0" name="radio" id="radio5-1"/>
<label for="radio5-1" class="radiobutton"> I am happy to have a go at new things.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio5-2"/>
<label for="radio5-2" class="radiobutton"> I draw up lists up possible courses of actions when starting a new project. </label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question6" id="Question6">
<tr><td class="question">6.
<input type="radio" value="radio0" name="radio" id="radio6-1"/>
<label for="radio6-1" class="radiobutton"> I like to get involved and to participate.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio6-2"/>
<label for="radio6-2" class="radiobutton"> I like to read and observe.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question7" id="Question7">
<tr><td class="question">7.
<input type="radio" value="radio0" name="radio" id="radio7-1"/>
<label for="radio7-1" class="radiobutton"> I am loud and outgoing.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio7-2"/>
<label for="radio7-2" class="radiobutton"> I am quiet and somewhat shy.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question8" id="Question8">
<tr><td class="question">8.
<input type="radio" value="radio0" name="radio" id="radio8-1"/>
<label for="radio8-1" class="radiobutton"> I make quick and bold decisions.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio8-2"/>
<label for="radio8-2" class="radiobutton"> I make cautious and logical decisions.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
<tr>
<form name="Question9" id="Question9">
<tr><td class="question">9.
<input type="radio" value="radio0" name="radio" id="radio9-1"/>
<label for="radio9-1" class="radiobutton"> I speak fast, while thinking.</label></td></tr>
<tr><td>   
<input type="radio" value="radio1" name="radio" id="radio9-2"/>
<label for="radio9-2" class="radiobutton"> I speak slowly, after thinking.</label></td></tr>
</form>
</tr>
<tr><td>    </td></tr>
</table>
<form id="form_end" action="insertResult.php">
<p>After answering each question, click on the button below.<p>
<p></p>
<input name="Determine Style" type="button" value="Determine Style" onClick="determineStyle()">
</form>
</div> <!-- End of Questions -->
<hr>
<div id="results" aria-live="polite">
<p><h3>Your survey results will appear here.</h3></p>
<p></p>
<a name="ShowResults" id="ShowResults"></a>
</div> <!-- Results -->
<div id="footer">
<p> </p>
</div> <!-- Footer -->
</div> <!-- Container -->
</body>
</html>
[/code]
0.1.9 — BETA 5.15