Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

php form repeat button after submit and null input

$
0
0

hello, 
i know the title looks little bit strange but i have an issue with my php form , after i submit with empty input box i don't get the echo results as wanted in the code with unanswered mark , as well when put right answer it gives back blank page after submitting or just the sentence of you like lemon . one more thing how can i add the button of repeat the exercise after submitting so it gives the form again for do the exercise over again, and how as well the button of showing results without taking the exam , means press the show results button shows them directly and thank you all in advance 

this is my code

<?php
$solution="do";
$solution3="do1";
if (isset($_POST['solution1'])){
  $solution1=$_POST['solution1'];
  if ($_POST['add']){
    if ($solution1 != $solution){
      echo '<span style="color: red;">'.$solution1.'</span> you like lemon?</br>';
    }
  } else if ($solution1 = null) { 
    echo '<span style="color: blue;">"unanswered"</span> you like lemon?</br>';
  } else { 
    echo '<span style="color: green;">'.$solution1.'</span> you like lemon?</br>';
  }
}
if (isset($_POST['solution2'])){
  $solution2=$_POST['solution2'];
  if ($_POST['add']){
    if ($solution2 != $solution3){
      echo '<span style="color: red;">'.$solution2.'</span> you like lemon?</br>' ;
    }
  } else if ($solution2 = null) { 
    echo '<span style="color: blue;">"unanswered"</span> you like lemon?</br>';
  } else { 
    echo '<span style="color: green;">'.$solution2.'</span> you like lemon?</br>';
  }
}
else {
?>
        <form   method="post" autocomplete="off" >
            <input type="text"  name="solution1" /> you like lemon?
            </br>
            <input type="text"  name="solution2" /> you like apple?
  
            <input  type="submit" name="add" value="Check" />
        </form>
<?php
}
?>

and thank you guys


Viewing all articles
Browse latest Browse all 13200

Trending Articles