- <?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 1 day ago Re: What is in Your Mind? View the latest post Replies 689 Views 275888
- by Eli 3 days ago Iran Launches Retaliatory Attack Against Israel, and Israel Retaliates by Attacking Iranian Isfahan Millitary Base View the latest post Replies 28 Views 924
- by Eli 5 days ago All in One: YouTube, TED, X, Facebook and Instagram Reels, Videos, Images and Text Posts View the latest post Replies 319 Views 10770
- by Eli 1 week ago Python Packages for Scientific Computing View the latest post Replies 8 Views 4653
- by Eli 1 week ago Dunia Yetu: Building Tanzania's Digital Future Together View the latest post Replies 5 Views 1874
- by Eli 1 week ago Russia Invades Ukraine View the latest post Replies 646 Views 212249
- by Eli 1 week ago Programmatically Move Files from One Folder to Another View the latest post Replies 6 Views 1440
- by Eli 2 weeks ago Collection of Greatest Christian Hymns of all Times View the latest post Replies 33 Views 45492
- by Eli 2 weeks ago What is Retrieval-Augmented Generation (RAG)? View the latest post Replies 2 Views 368
- by Eli 2 weeks ago Chat With ChatGPT - An Interactive Conversational AI View the latest post Replies 22 Views 26147
-
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 4 guests