diff --git a/addDetails.php b/addDetails.php index 04f228b..fb79396 100644 --- a/addDetails.php +++ b/addDetails.php @@ -1,33 +1,31 @@ -alert('Details Inserted')"; - echo ""; - } +if (isset($_POST['submit'])) { + $firstName = filter($_POST['firstName']); + $lastName = filter($_POST['lastName']); + $email = filter($_POST['email'])/* */; - else - { - echo "Unable to insert the details"; - } - } - ?> \ No newline at end of file + $query = $pdo->prepare("INSERT INTO developerdetails (firstName, LastName, email) VALUES (?, ?, ?)"); + $query->bindParam(1, $firstName); + $query->bindParam(2, $lastName); + $query->bindParam(3, $email); + + if ($query->execute()) { + echo ""; + echo ""; + } else { + echo "Unable to insert the details"; + } +} diff --git a/app/connection.php b/app/connection.php new file mode 100644 index 0000000..f055386 --- /dev/null +++ b/app/connection.php @@ -0,0 +1,11 @@ + "SET NAMES utf8", + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION +)); diff --git a/app/helpers.php b/app/helpers.php new file mode 100644 index 0000000..4a8e795 --- /dev/null +++ b/app/helpers.php @@ -0,0 +1,12 @@ + +
- - -