-
Notifications
You must be signed in to change notification settings - Fork 0
/
form.php
55 lines (50 loc) · 1.41 KB
/
form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$server = "localhost";
$username = "root";
$password = "";
$dbname ="LuanTech";
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$pre = $_POST['pre'];
$committee = $_POST['committee'];
$conn = new mysqli($server,$username,$password,$dbname);
if ($conn -> connect_error) {
die('connection failed'.$conn ->connect_error);
}
else
{
$stmt = $conn -> prepare("INSERT INTO form (id, name, email, phone, previous, committe)
VALUES (NULL, ?, ?, ?, ?, ?)");
$stmt -> bind_param("ssiss",$name,$email,$phone,$pre,$committee);
$stmt -> execute();
echo 'sucess';
$stmt -> close();
$conn -> close();
}
// if (isset($_POST['submit'])) {
// if (!empty($_POST['name']) && !empty($_POST['email'])
// && !empty($_POST['phone'])&& !empty($_POST['pre']))
// {
// $name = $_POST['name'];
// $email = $_POST['email'];
// $phone = $_POST['phone'];
// $pre = $_POST['pre'];
// $committee = $_POST['committee'];
// $query = "INSERT INTO form (id, name, email, phone, previous, committe)
// VALUES (NULL, '$name', '$email', '$phone', '$pre', '$committee')";
// $run = mysqli_query($conn,$query) or die(mysqli_error());
// if ($run) {
// echo 'successfully submitted';
// }
// else
// {
// echo "not submitted";
// }
// }
// else
// {
// echo " all fields required";
// }
// }
?>