I have multiple pages and each page has multiple radio buttons which pass values and after checking different selections across all radio buttons output a unique result currently I am creating too many if conditions which is difficult to main, can an array or loop be done for it.
<?php
if(isset($_POST['material'])) {
$_SESSION['material'] = $_POST['material'];
// for screw
if($_SESSION['category'] == "Screw" ) {
if($_SESSION['headtype'] == "Counter Sink Philips") {
if($_SESSION['diameter'] == "6 MM"){
if($_SESSION['length'] == "10 MM"){
if($_SESSION['pitch'] == "1 MM") {
if($_SESSION['material'] == "Brass") {
echo "kenenth start with database";
}
}
}
}
}
}
// for self tapping
if($_SESSION['category'] == "Self Tapping" ) {
if($_SESSION['headtype'] == "Counter Sink Philips") {
if($_SESSION['diameter'] == "6 MM"){
if($_SESSION['length'] == "10 MM"){
if($_SESSION['pitch'] == "1 MM") {
if($_SESSION['material'] == "Brass") {
echo "Self Tapping";
}
}
}
}
}
}
// for stud
if($_SESSION['category'] == "Stud" ) {
if($_SESSION['headtype'] == "Counter Sink Philips") {
if($_SESSION['diameter'] == "6 MM"){
if($_SESSION['length'] == "10 MM"){
if($_SESSION['pitch'] == "1 MM") {
if($_SESSION['material'] == "Brass") {
echo "Stud";
}
}
}
}
}
}
}
?>