-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess-exampleform.php
More file actions
44 lines (32 loc) · 1.02 KB
/
process-exampleform.php
File metadata and controls
44 lines (32 loc) · 1.02 KB
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
<?php
$First_Name=$_POST["First_Name"];
$Last_Name=$_POST["Last_Name"];
$host="localhost";
$dbname="database name";
$username="username";
$password="";
$conn=mysqli_connect($host,$username,$password,$dbname);
if(mysqli_connect_errno()){
die("Connection Error:".mysqli_connect_error());
}
$sql="INSERT INTO Details(First_Name,Last_Name)
VALUES(?,?)";
$stmt=mysqli_stmt_init($conn);
if(! mysqli_stmt_prepare($stmt,$sql)){
die(mysqli_error($conn));
}
mysqli_stmt_bind_param($stmt,"ss",
$First_Name,
$Last_Name,
);
mysqli_stmt_execute($stmt);
echo"Record saved";
?>
Then you need to create another php. File to connect webpage and example php file.
<?php
//connection for the database to html
$con=mysqli_connect("localhost","user name","password","database");
if(!$con){
die("Connection error");
}
?>