Thanks for the question here. I am here to help you. You are not described well with your HTML and PHP code. You should not include a code screenshot. You should include code only with description. I am understanding your concern. You want to insert radio button data like gender male or female in the database using PHP and MYSQL database. It's really simple.
Let's follow the steps -
How to insert data using the radio button in PHP?
Step 1 - First of all create a database using the query
CREATE TABLE `data` (
`id` INT( 50 ) NOT NULL ,
`name` VARCHAR( 40 ) NOT NULL ,
`gender` VARCHAR( 30 ) NOT NULL ,
In the query above, I created three columns and a table name. We use the gender column and will insert male or female values.
Step 2- Now you need to create an HTML form with one input box and two radio buttons.
Let's have a look -
<form action="" method="post"
<input type="text" name="name"><br><br>
<input type="radio" name="gender" value="Male">Male
<input type="radio" name="gender" value="Female">Female
<input type="submit" value="Submit" name="submit">
Step 3- If you want to insert gender in the database, you have to create PHP code with MYSQL query
Let's create a PHP script to insert gender Male or Female in PHP.
$databaseHost = 'localhost';
$databaseName = 'records';
$databaseUsername = 'root';
$databasePassword = '';
$mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName);
$name = $_POST['name'];
$gender = $_POST['gender'];
$result = mysqli_query($mysqli,"insert into data values('','$name','$gender')");
echo "Data inserted ";
echo "Something wrong";
Execute the code above. In this way, you can insert gender male or female in the database.
If you have another issue, you can discuss it in the comment.