- <?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 All in One: YouTube, TED, X, Facebook and Instagram Reels, Videos, Images and Text Posts View the latest post Replies 332 Views 40383
- by Eli 1 day ago Iran's President Ebrahim Raisi Aged 63 Dies in a Helicopter Crash View the latest post Replies 3 Views 63
- by Eli 1 day ago Re: What is in Your Mind? View the latest post Replies 717 Views 307130
- by Eli 3 days ago PySpark for Large Data Processing View the latest post Replies 2 Views 8171
- by Eli 3 days ago Online Bible View the latest post Replies 3 Views 23330
- by Eli 3 days ago Generating SSH Key and Adding it to the ssh-agent for Authentication on GitHub View the latest post Replies 1 Views 487
- by Eli 1 week ago Russia Invades Ukraine View the latest post Replies 663 Views 240936
- by Eli 2 weeks ago President Museveni's Speech During International Development Association (IDA) Summit View the latest post Replies 1 Views 509
- by Eli 2 weeks ago From Simple Linear Regression Analysis to Covariance & Correlation to Independent Determinant, and R-Squared View the latest post Replies 11 Views 25143
- by Eli 2 weeks ago Collection of Greatest Christian Hymns of all Times View the latest post Replies 34 Views 72538
-
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