/    Sign up×
Community /Pin to ProfileBookmark

select option display

Hi! I was trying to make a survey or questionaire script but got stuck when I got there
can anyone pinpoint the mistake I am making here?
Thanks in advance!

question.php

[code=php]
<form action=”result.php” method=”post”>
<input blahblah><br><br>

I <select name=”hh”>
<option value=”nonehh”>—-</option>
<option value=”have”>have</option>
<option value=”has”>has</option>
</select> been trying…
[/code]

result.php

[code=php]
Please correct the sentences and questions into correct form.<br>
I
<?php if($have==$have)
{echo”<font color=’black’ style=’text-decoration:underline;’>have</font> “;}
elseif($has==$has)
{echo “<font color=’red’> has </font>”;}
else
{ echo “<font color=’red’>_____</font>”;}?>

been trying…
[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@SheldonSep 13.2007 — [code=php]
Please correct the sentences and questions into correct form.<br>
I
<?php
$hh = $_POST['hh'];

if($hh == "have"){
echo("<font color='black' style='text-decoration:underline;'>have</font> ");
}elseif($hh == "has"){
echo("<font color='red'> has </font>");
}else{
echo("<font color='red'>_____</font>");
}
?>

been trying...[/code]
Copy linkTweet thisAlerts:
@MichaelttkkauthorSep 13.2007 — thanks! It works perfectly.
Copy linkTweet thisAlerts:
@MichaelttkkauthorSep 14.2007 — just one more addition. I'd like to grade their answer.

when I did like this:
[code=php]
<?php
$am = $_POST['am']="1";
$is = $_POST['is']="1";
$total = $am + $is;
echo "The total is - <b>".$total."</b>.";

I got the total score. But can't think of how I can grade their answers.
?>[/code]


here's the script which I've been trying to work it on
[code=php]
<?
$am = $_POST['am'];
$is = $_POST['is'];
$are = $_POST['are'];
$was = $_POST['was'];
$were = $_POST['were'];
$be = $_POST['be'];
$reading1 = $_POST['reading1'];
$reading2 = $_POST['reading2'];
$readingpast = $_POST['readingpast'];
$readingpast1 = $_POST['readingpast1'];
$readingpast2 = $_POST['readingpast2'];
$readingfuture = $_POST['readingfuture'];
$readingfuture1 = $_POST['readingfuture1'];
$readingfuture2 = $_POST['readingfuture2'];
$haveto1 = $_POST['haveto1'];
$haveto2 = $_POST['haveto2'];
$havetopast = $_POST['havetopast'];
$havetopast1 = $_POST['havetopast1'];
$havetopast2 = $_POST['havetopast2'];
$havetofuture = $_POST['havetofuture'];
$havetofuture1 = $_POST['havetofuture1'];
$havetofuture2 = $_POST['havetofuture2'];
$canhelp1 = $_POST['canhelp1'];
$canhelp2 = $_POST['canhelp2'];
$canhelppast = $_POST['canhelppast'];
$canhelppast1 = $_POST['canhelppast1'];
$canhelppast2 = $_POST['canhelppast2'];
$canhelpfuture = $_POST['canhelpfuture'];
$canhelpfuture1 = $_POST['canhelpfuture1'];
$canhelpfuture2 = $_POST['canhelpfuture2'];

$have = $_POST['have'];
$has = $_POST['has'];
$s1 = $_POST['s1'];
$s2 = $_POST['s2'];
$d1 = $_POST['d1'];
$d2 = $_POST['d2'];
$can = $_POST['can'];
$could = $_POST['could'];
$beableto = $_POST['beableto'];
$ableto = $_POST['ableto'];
$amoption = $_POST['amoption'];
$wasoption = $_POST['wasoption'];

$hh = $_POST['hh'];
$ss = $_POST['ss'];
$dd = $_POST['dd'];
$cc = $_POST['cc'];
$ab = $_POST['ab'];
$aw = $_POST['aw'];

?>


<form action="quiz1result.php" method="POST">
<h1>Quiz I</h1>
1. Please write down the Be-Verbs.<br>
*<input type="text" name="am" value="<?php echo $am;?>">
<?php if($am =="am") {echo"Correct! The answer is: am.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: am.</font>";}?><br>
*<input type="text" name="is" value="<?php echo $is;?>">
<?php if($is == "is") {echo"Correct! The answer is: is.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: is</font>";}?><br>
*<input type="text" name="are" value="<?php echo $are;?>">
<?php if($are =="are") {echo"Correct! The answer is: are.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: are</font>";}?><br>
*<input type="text" name="was" value="<?php echo $was;?>">
<?php if($was =="was") {echo"Correct! The answer is: was.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: was</font>";}?><br>
*<input type="text" name="were" value="<?php echo $were;?>">
<?php if($were =="were") {echo"Correct! The answer is: were.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: were</font>";}?><br>
*<input type="text" name="be" value="<?php echo $be;?>">
<?php if($be =="be") {echo"Correct! The answer is: be.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: be</font>";}?><br>
<hr noshade><br>

2. Are you reading books? <br>
<textarea cols="50" rows="2" name="reading1"><?php echo $reading1;?></textarea>
<?php if($reading1 =="Yes, I am reading books.") {echo"Correct! The answer is: Yes, I am reading books.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: Yes, I am reading books.</font>";}?><br><br>
<textarea cols="50" rows="2" name="reading2"><?php echo $reading2;?></textarea>
<?php if($reading2 =="No, I am not reading books.") {echo"Correct! The answer is: No, I am not reading books.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: No, I am not reading books.</font>";}?><br><hr noshade><br>

3. Are you reading books? Please write it in Past form.<br>
<textarea cols="50" rows="2" name="readingpast"><?php echo $readingpast;?></textarea>
<?php if($readingpast =="Were you reading books?")
{echo"Correct! The answer is: Were you reading books?";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: Were you reading books?</font>";}?>
<br><br>
<textarea cols="50" rows="2" name="readingpast1"><?php echo $readingpast1;?></textarea>
<?php if($readingpast1 =="Yes, I was reading books.")
{echo"Correct! The answer is: Yes, I was reading books.";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: Yes, I was reading books.</font>";}?>
<br><br>
<textarea cols="50" rows="2" name="readingpast2"><?php echo $readingpast2;?></textarea>
<?php if($readingpast2 =="No, I was not reading books.")
{echo"Correct! The answer is: No, I was not reading books.";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: No, I was not reading books.</font>";}?><br>
<hr noshade><br>

4. Are you reading books? Please write it in Future form.<br>
<textarea cols="50" rows="2" name="readingfuture"><?php echo $readingfuture;?></textarea>
<?php if($readingfuture =="Will you be reading books?")
{echo"Correct! The answer is: Will you be reading books?";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: Will you be reading books?</font>";}?>
<br><br>
<textarea cols="50" rows="2" name="readingfuture1"><?php echo $readingfuture1;?></textarea>
<?php if($readingfuture1 =="Yes, I will be reading books.")
{echo"Correct! The answer is: Yes, I will be reading books.";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: Yes, I will be reading books.</font>";}?>
<br><br>
<textarea cols="50" rows="2" name="readingfuture2"><?php echo $readingfuture2;?></textarea>
<?php if($readingfuture2 =="No, I will not be reading books..")
{echo"Correct! The answer is: No, I will not be reading books.";}
else
{echo"<font color='red'>Sorry, Wrong answer! The answer is: No, I will not be reading books.</font>";}?><br>
<hr noshade><br>

5. Please correct the sentences and questions into correct form.<br>
I <?php
$hh = $_POST['hh'];

if($hh == "have"){
echo("<font color='black' style='text-decoration:underline;'>have</font> ");
}elseif($hh == "has"){
echo("<font color='red'> has </font>");
}else{
echo("<font color='red'>_____</font>");
}
?>
to study because I want to become a high school <?php
$ss = $_POST['ss'];

if($ss == "student"){
echo("<font color='black' style='text-decoration:underline;'>student</font> ");
}elseif($ss == " students "){
echo("<font color='red'> students </font>");
}else{
echo("<font color='red'>_______</font>");
}
?> . <?php
$dd = $_POST['dd'];

if($hh == "Do"){
echo("<font color='black' style='text-decoration:underline;'>Do</font> ");
}elseif($hh == "Does"){
echo("<font color='red'> Does </font>");
}else{
echo("<font color='red'>_____</font>");
}
?> your friends have to study, too? My friend,<br> John, studies everyday and he <?php
$cc = $_POST['cc'];

if($cc == "can"){
echo("<font color='black' style='text-decoration:underline;'>can</font> ");
}elseif($cc == "could"){
echo("<font color='red'> could </font>");
}else{
echo("<font color='red'>_______</font>");
}
?> study Math yesterday. Will you <?php
$ab = $_POST['ab'];

if($ab == "be able to"){
echo("<font color='black' style='text-decoration:underline;'>be able to</font> ");
}elseif($ab == "able to"){
echo("<font color='red'> able to </font>");
}else{
echo("<font color='red'>__________</font>");
}
?> sing tomorrow? I <?php
$aw = $_POST['aw'];

if($aw == "was"){
echo("<font color='black' style='text-decoration:underline;'>was</font> ");
}elseif($aw == "am"){
echo("<font color='red'> am </font>");
}else{
echo("<font color='red'>____</font>");
}
?> busy yesterday.<br>
<br>
<a href="/english/quiz1.php">Click here to take one more time</a>
<br><br>
<?php
$total = $hh + $ss + $dd + $cc + $ab + $aw + $am + $is + $are + $was + $were + $be +
$reading1 + $reading2 + $readingpast + $readingpast1 + $readingpast2+
$readingfuture + $readingfuture1 + $readingfuture2;
echo "The total score is -<b> ".$total.".</b>";
?>[/code]
Copy linkTweet thisAlerts:
@MichaelttkkauthorSep 15.2007 — I figured it out to a certain level

[code=php]

1. Please write down the Be-Verbs.<br>
*<input type="text" name="am" value="1">
<?php if($am =="am") {echo"Correct! The answer is: am.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: am.</font>";}?><br>
*<input type="text" name="is" value="1">
<?php if($is == "is") {echo"Correct! The answer is: is.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: is</font>";}?><br>
*<input type="text" name="are" value="1">
<?php if($are =="are") {echo"Correct! The answer is: are.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: are</font>";}?><br>
*<input type="text" name="was" value="1">
<?php if($was =="was") {echo"Correct! The answer is: was.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: was</font>";}?><br>
*<input type="text" name="were" value="1">
<?php if($were =="were") {echo"Correct! The answer is: were.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: were</font>";}?><br>
*<input type="text" name="be" value="1">
<?php if($be =="be") {echo"Correct! The answer is: be.";}else{echo"<font color='red'>Sorry, Wrong answer! The answer is: be</font>";}?><br>
<hr noshade><br>
<?php
$num1 = 1;$num2 = 1;$num3 = 1;$num4 = 1;$num5 = 1;$num6 = 1;
if($am=am) { $num1}else{echo "nothing";}
if($is=is) { $num2}else{echo "nothing";}
if($are=are) { $num3}else{echo "nothing";}
if($was=was) { $num4}else{echo "nothing";}
if($were=were) { $num5}else{echo "nothing";}
if($be=be) { $num6}else{echo "nothing";}

$total = $num1+ $num2 + $num3 + $num4 + $num5 + $num6;
echo $total;
?>
[/code]


just that all the textarea should be changed to input

any suggestion is appreciated
×

Success!

Help @Michaelttkk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...