jeudi 11 janvier 2018

Output from Form with PHP IF statment [duplicate]

This question already has an answer here:

I'm using WordPress as a framework for my website (some of its functionality just seems intuitive), but I am running into a major issue.

On page 1, I have a form similar to this...

Choose any two of the following...

<form method="get" action="output.php" target="_blank">
<input type="checkbox" name="option1" value="5">Option 1
<input type="checkbox" name="option2" value="10">Option 2
<input type="checkbox" name="option3" value="15">Option 3
<input type="submit" value="Submit">
</form>

This form seems to work great. But when user is redirected to 'output.php' I'm getting an error. The code for the custom template looks something like this...

<?php Template Name: Output ?>
<html>
<head></head>
<body>
<?php
  if ($_GET['option1']+$_GET['option2']+$_GET['option3'] = '15') {
     echo "Good";}
  if ($_GET['option1']+$_GET['option2']+$_GET['option3'] = '20') {
     echo "Better";}
  if ($_GET['option1']+$_GET['option2']+$_GET['option3'] = '25') {
     echo "Best";}
}
?>
</body>
<footer></footer>
</html>

I'm sort of new to coding with PHP so any formatting points would be great.

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire