-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
48 lines (43 loc) · 1.22 KB
/
form.php
File metadata and controls
48 lines (43 loc) · 1.22 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
45
46
47
48
<?php
include('config.php')
?>
<?php
if(isset($_POST['submit'])){
$username = $_POST['name'];
$city = $_POST['city'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$sql = "INSERT INTO `users` (`username`, `email`, `gender`, `city`) VALUES ('$username', '$email', '$gender', '$city')";
if(!mysqli_query($conn, $sql)){
echo "Error1 ". mysqli_error($conn);
}
else{
echo "Data sent successfully....1";
}
}
else{
echo "please enter the details";
}
?>
<!DOCTYPE html>
<head>
</head>
<html>
<body>
<form method="POST" action="form.php">
Name <input type="text" name="name" required ><br>
E-mail <input type="email" name="email" required ><br>
Gender:
Male <input type="radio" value="male" name="gender">
Female <input type="radio" value="female" name="gender"><br>
Select City <select name="city">
<option value="Dehradun">Dehradun</option>
<option value="Delhi">Delhi</option>
<option value="Jaipur">Jaipur</option>
<option value="Lucknow">Lucknow</option>
<option value="Kanpur">Kanpur</option>
</select><br>
<input type="submit" name="submit" value="Click Here To Submit Your Data">
</form>
</body>
</html>