- <?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 11 hours ago All in One: YouTube, TED, X, Facebook and Instagram Reels, Videos, Images and Text Posts View the latest post Replies 328 Views 37811
- by Eli 11 hours ago Re: What is in Your Mind? View the latest post Replies 705 Views 303548
- by Eli 4 days ago Russia Invades Ukraine View the latest post Replies 663 Views 238534
- by Eli 6 days ago PySpark for Large Data Processing View the latest post Replies 1 Views 7934
- by Eli 1 week ago President Museveni's Speech During International Development Association (IDA) Summit View the latest post Replies 1 Views 325
- by Eli 1 week ago From Simple Linear Regression Analysis to Covariance & Correlation to Independent Determinant, and R-Squared View the latest post Replies 11 Views 24934
- by Eli 2 weeks ago Collection of Greatest Christian Hymns of all Times View the latest post Replies 34 Views 70514
- by Eli 2 weeks ago Pondering Big Cosmology Questions Through Lectures and Dialogues View the latest post Replies 34 Views 58509
- by Eli 2 weeks ago Programmatically Manipulate Files: Renaming, Reading, Writing, Deleting, and Moving Files Between Folders View the latest post Replies 7 Views 18612
- by Eli 3 weeks ago Iran Launches Retaliatory Attack Against Israel, and Israel Retaliates by Attacking Iranian Isfahan Millitary Base View the latest post Replies 28 Views 20930
-
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