- <?php
- $conn=mysqli_connect("localhost","root","tssfl");
- mysqli_select_db($conn,"simple");
- if(isset($_POST['btn'])) {
- if (isset($_POST['checks'])){
- $terms="Accepted";
- }elseif (!isset($_POST['checks'])){
- echo "Accept terms and Condition";
- exit();
- }
- if (isset($_POST['gender'])) {
- $gvalue=$_POST['gender'];
- }elseif (!isset($_POST['gender'])) {
- echo "Select gender";
- exit();
- }
- $sql = "INSERT INTO checks (sex,terms) VALUES ('$gvalue','$terms')";
- if (mysqli_query($conn, $sql)) {
- echo "success";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Testing</title>
- </head>
- <body>
- <div style="margin-left: auto;margin-right: auto; width:50%;background-color: #eaeaea;margin-top: 100px;">
- <h1>Select user information</h1>
- <form action="index.php" method="post">
- <p><input type="checkbox" value="Accepted" name="checks">Terms and Condition</p>
- <p>Choose Gender</p>
- <p><input type="radio" value="Male" name="gender">Male</p>
- <p><input type="radio" value="Female" name="gender">Female</p>
- <p><input type="radio" value="Other" name="gender">Other</p>
- <input type="submit" name="btn" value="Save">
- </form>
- </div>
- </body>
- </html>
-
- Active Topics
-
-
- by Eli 8 hours ago Russia Invades Ukraine View the latest post Replies 674 Views 263750
- by Eli 10 hours ago All in One: YouTube, TED, X, Facebook and Instagram Reels, Videos, Images and Text Posts View the latest post Replies 334 Views 54235
- by Eli 22 hours ago Re: What is in Your Mind? View the latest post Replies 731 Views 330184
- by Eli 4 days ago Shared Images View the latest post Replies 6 Views 1601
- by Eli 6 days ago Dr Wahome: How World Health Organization (WHO) is Doing Bad Things View the latest post Replies 1 Views 182
- by Eli 1 week ago Introduction to Abstract Algebra View the latest post Replies 4 Views 11120
- by Eli 1 week ago Generating SSH Key and Adding it to the ssh-agent for Authentication on GitHub View the latest post Replies 2 Views 1269
- by Eli 1 week ago How AI Could Empower any Business View the latest post Replies 1 Views 380
- by Eli 1 week ago Pondering Big Cosmology Questions Through Lectures and Dialogues View the latest post Replies 35 Views 62517
- by Eli 1 week ago The U.S - China Rivalry, Taiwan and Hong Kong View the latest post Replies 1 Views 508
-
How to store HTML checkbox values and radio button values in database using PHP
0
-
- Information
-
Who is online
Users browsing this forum: No registered users and 0 guests