Quiz form with random questions How could I make this code more efficient?  Instead of using many if-statements, should I make a function, array, or switch?  How would I do that?

&lt;form method="post" action="trivia2.php"&gt;
&lt;ol&gt;
&lt;li&gt;How many days are in a week? &lt;input type="text" name="daysweek"&gt;&lt;/li&gt;
&lt;li&gt;How many days are in a year? &lt;input type="text" name="daysyear"&gt;&lt;/li&gt;
&lt;li&gt;How many weeks are in a year? &lt;input type="text" name="weeksyear"&gt;&lt;/li&gt;
&lt;li&gt;What color is the sky? &lt;input type="text" name="colorsky"&gt;&lt;/li&gt;
&lt;li&gt;what is us president name? &lt;input type="text" name="presidentname"&gt;&lt;/li&gt;
&lt;li&gt;How many sides does a triangle have? &lt;input type="text" name="sidestriange"&gt;&lt;/li&gt;
&lt;li&gt;What is the first element on the periodic table of elements? &lt;input type="text" name="firstelement"&gt;&lt;/li&gt;
&lt;li&gt;Bees create what sweet substance? &lt;input type="text" name="beesubstance"&gt;&lt;/li&gt;
&lt;li&gt;How many stripes are displayed on the American flag?&lt;input type="text" name="stripes"&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;input type="submit" value="Done!"/&gt;
&lt;/form&gt;
&lt;?php
$daysweek=$_POST['daysweek'];
$daysyear=$_POST['daysyear'];
$weeksyear=$_POST['weeksyear'];
$colorsky=$_POST['colorsky'];
$presidentname=$_POST['presidentname'];
$sidestriangle=$_POST['sidestriange'];
$firstelement=$_POST['firstelement'];
$beesubstance=$_POST['beesubstance'];
$stripes=$_POST['stripes'];
$wrong=0;
if($daysweek==7){
echo "1. you got the right answer: $daysweek&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 1 is wrong&lt;br/&gt;";}

if($daysyear==365){
echo "2. you got the right answer: $daysyear&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 2 is wrong&lt;br/&gt;";}

if($weeksyear==52){
echo "3. you got the right answer: $weeksyear&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 3 is wrong&lt;br/&gt;";}

if($colorsky=='blue'){
echo "4. you got the right answer: $colorsky&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 4 is wrong&lt;br/&gt;";}

if($presidentname=='obama'){
echo "5. you got the right answer: $presidentname&lt;/br&gt;";
}else {
    $wrong++;
    echo "number 5 is wrong&lt;br/&gt;";}

if($sidestriangle==3){
echo "6. you got the right answer: $sidestriangle&lt;/br&gt;";
}else {
    $wrong++;
    echo "number 6 is wrong&lt;br/&gt;";}

if($firstelement=='hydrogen'){
echo "7. you got the right answer: $firstelement&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 7 is wrong&lt;br/&gt;";}

if($beesubstance=='honey'){
echo "8. you got the right answer: $beesubstance&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 8 is wrong&lt;br/&gt;";}

if($stripes==13){
echo "9. you got the right answer: $stripes&lt;br/&gt;";
}else {
    $wrong++;
    echo "number 9 is wrong&lt;br/&gt;";}
echo "&lt;h3&gt;You have $wrong wrong answers&lt;/h3&gt;";
?&gt;
Theres nothing particularly unefficient about what you have, but there are a couple of things. instead of storing the variables like

$daysweek=$_POST['daysweek'];


just leave them in $_POST like 

if($_POST['daysweek']==7){//..


and then instead of 

echo "1. you got the right answer: $daysweek&lt;br/&gt;";


you already know the answer is 7 so just

echo "1. you got the right answer: 7&lt;br/&gt;";


but based on the content of your application you are not yet in a place where you need to be worrying about optimization