w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to display a form answer if it matches the answer in an array in php

You can check it with in_array function like this:

if (in_array($_POST['answer'], $families['Griffin'])) 
 // true 
}   else
// false

Also you need to set proper name to your radio buttons which is:

A: <input type = "radio" name = "answer"
B: <input type = "radio" name = "answer" value="Glenn">Glenn
C: <input type = "radio" name = "answer" value="Meg">Meg
D: <input type = "radio" name = "answer" value="Quagmire">Quagmire

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.