Hi I am pretty new to PHP. I am trying to get the selected value from my radio button in PHP but I am unable to get the selected value. I have populated the values by connecting to my DB (MySQL) but I am unable to get the assigned value from the radio button. It always escapes the if condition and says "No Value Selected" and I am not able to assign the value and save it to my DB
Appreciate your help.
My index.php is as follows `
<?php
session_start();
$_SESSION['timein']= time();
?>
<?php
include("config.php");
$conn = mysqli_connect($dbHost, $dbuser, $dbpassword, $dbDatabase);
$query_salutation_type='SELECT salutation_description FROM tbl_salutation;';
$select_salutation_type=mysqli_query($conn, $query_salutation_type);
while($row1 = mysqli_fetch_array($select_salutation_type))
{
echo '<input type="radio" name="salutation_description" value="'.$row1[0].'"/>'.$row1[0];
}
?>
<html>
<body>
<form method="post" action="capture_data.php" >
<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>
`
My capture_data.php is as follows
<?php
if(isset($_POST['submit']))
{
if(isset($_POST['salutation_description']))
{
$selected_val = $_POST['salutation_description'];
echo "You have selected :" .$selected_val;
}
else
{
echo 'No Value Selected';
}
}
?>
