From f5e5cfa6c26e6f41af74c33a5a6726e50ef164f1 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Thu, 24 Aug 2023 22:52:23 +0530 Subject: Lab03 - Create a Registration form using HTML Forms --- Lab03/insert.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Lab03/insert.php (limited to 'Lab03/insert.php') diff --git a/Lab03/insert.php b/Lab03/insert.php new file mode 100644 index 0000000..a7efb70 --- /dev/null +++ b/Lab03/insert.php @@ -0,0 +1,42 @@ +connect_error) { + die("Connection failed: " + . $conn->connect_error); +} + +$fname = $_REQUEST['fname']; +$lname = $_REQUEST['lname']; +$gender = $_REQUEST['gender']; +$regno = $_REQUEST['regno']; +$phone = $_REQUEST['phone']; +$email = $_REQUEST['email']; +$department = $_REQUEST['department']; + +$sql = "INSERT INTO $dbname VALUES ('$fname','$lname','$gender','$regno','$email',$department)"; + +if(mysqli_query($conn, $sql)){ + echo "

data stored in a database successfully." + . " Please browse your localhost php my admin" + . " to view the updated data

"; + + echo nl2br("\n$first_name\n $last_name\n " + . "$gender\n $address\n $email"); +} else{ + echo "ERROR: Could not insert the data values $sql. " + . mysqli_error($conn); +} + +// Close connection +mysqli_close($conn); +?> \ No newline at end of file -- cgit v1.2.3