잘 작동하는 양식이 있습니다. 나는 잘 작동하는 퀴즈를 가지고있다.PHP 폼을 사용하여 퀴즈 답을 보내기
내가 두가 작동하지 않는 통합 할 때 잘 :(
퀴즈 퀴즈로 작동하지만 실 거예요 내 이메일 주소로 PHP를 사용하여 발송. 여기
는 약간의 내 코드 :<head>
<script>
CorrectAnswers = new Array();
CorrectAnswers[0]=1;
CorrectAnswers[1]=1;
CorrectAnswers[2]=1;
CorrectAnswers[3]=2;
macrightchar='YES';
macwrongchar='NO';
winrightchar='YES';
winwrongchar='NO';
var platform = 'win'
if (navigator.appVersion.indexOf('Mac') != -1) {platform = 'mac'}
if (platform == 'mac') {
rightchar = unescape(macrightchar)
wrongchar = unescape(macwrongchar)
}
else {
rightchar = unescape(winrightchar)
wrongchar = unescape(winwrongchar)
}
function CheckAnswer(){
var i = 0;
var TotalCorrect = 0;
var x = 0;
var Score = 0;
for (i=0; i<CorrectAnswers.length; i++){
if (document.QuizForm.elements[i*2].selectedIndex == CorrectAnswers[i]){
document.QuizForm.elements[(i*2)+1].value = rightchar;
TotalCorrect++;
}
else{
document.QuizForm.elements[(i*2)+1].value = wrongchar;
}
}
Score = Math.floor((TotalCorrect*100)/CorrectAnswers.length);
document.CheckForm.ScoreBox.value = Score + '%';
}
</script>
</head>
<body>
<form name="QuizForm" accept-charset="utf-8" method="post" action="forms/quiz/_process.php" onSubmit="return validate.check(this)">
<table class="widthOneHundredPercent">
<tr>
<td class="tableCellFloat columnOne" valign="top">
<label for="Big_Media_offers_a_great_multiplatform_tool">Big Media offers a great multiplatform tool</label>
</td>
<td class="tableCellFloat columnTwo" valign="top">
<select name="0">
<option>???</option>
<option>True</option>
<option>False</option>
</select>
<td valign=top>
<input type="text" name="1" size=2 maxlength=2>
</td>
</td>
</tr>
<tr>
<FORM name="CheckForm">
<td align="center">
<font face="Geneva,Arial"><input type="button" VALUE="Check" onClick="CheckAnswer()"> Your score is <input type=text name="ScoreBox" size="4" maxlength="4"></font>
<center><input type="submit" value="Submit Form" /></center>
</form>
가 quiz.php하는 quiz.php에서 주소 표시 줄에 내 파일 이름의 끝을 변경됩니다 누르면 제출하면 ScoreBox = 75 % 25 내 정답과 오답을합니다 그래서?. .
체크 점수를 클릭 할 때 라이브 오른쪽 및 잘못된 답변을 표시하려면 퀴즈가 필요하지만 PHP를 사용하여 결과를 보내야합니다.
내가 완전히 잘못 될 가능성이 있다면 누군가가 나를 올바른 방향으로 향하게 할 수 있습니다.
감사합니다.
PHP 빌드에서 전자 메일을 보낼 수 있습니까? –
예, 유료 시스템이므로 여기에 코드를 추가하지 마십시오. –
당신은 php에 문제가 있습니다 (폼을 사용하지 않고 결과를 보여주는 것).하지만 자바 스크립트와 html은 모두 – mishu