summaryrefslogtreecommitdiff
path: root/Lab06/form1_submit.php
diff options
context:
space:
mode:
Diffstat (limited to 'Lab06/form1_submit.php')
-rw-r--r--Lab06/form1_submit.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/Lab06/form1_submit.php b/Lab06/form1_submit.php
new file mode 100644
index 0000000..f1cb514
--- /dev/null
+++ b/Lab06/form1_submit.php
@@ -0,0 +1,34 @@
+<html>
+
+<body>
+ Welcome <?php echo $_POST["fname"]; ?><br>
+ Your email address is:<?php echo $_POST["email"]; ?><br>
+ <?php
+ echo "<pre>";
+ print_r($_POST);
+ echo "</pre>";
+ $servername = "localhost";
+ $username = "it";
+ $password = "smit#1234";
+ $dbname = "it_202000096";
+ //Create connection
+ $conn = mysqli_connect($servername, $username, $password,$dbname);
+ //Check connection
+ if ($conn->connect_error) {
+ die("Connection failed: " . $conn->connect_error);
+ }
+ $fname= $_POST['fname'];
+ $lname= $_POST['lname'];
+ $age= $_POST['age'];
+ $gender= $_POST['gender'];
+ $email= $_POST['email'];
+ $sql = "INSERT INTO student (fname, lname, age, gender,email) VALUES ('$fname','$lname','$age','$gender','$email')";
+ if (mysqli_query($conn, $sql)) {
+ echo "New record created successfully";
+ } else {
+ echo "Error: " . $sql . "<br>" . mysqli_error($conn);
+ }
+ mysqli_close($conn);
+ ?>
+</body>
+</html>