-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersonal_Info_Form.html
More file actions
91 lines (81 loc) · 3.12 KB
/
Personal_Info_Form.html
File metadata and controls
91 lines (81 loc) · 3.12 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personal Info System</title>
<style>
body { font-family: Arial, sans-serif; margin: 0; padding: 0; }
.container {
max-width: 600px;
margin: 50px auto;
padding: 20px;
background: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
h2 { text-align: center; margin-bottom: 20px; }
label { display: block; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], textarea {
width: 100%;
padding: 8px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
}
textarea { resize: vertical; }
input[type="button"] {
background: #4CAF50;
color: #fff;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
input[type="button"]:hover { background: #45a049; }
.info { margin-top: 20px; padding: 10px; border: 1px solid #ddd; border-radius: 4px; background: #f9f9f9; }
</style>
</head>
<body>
<div class="container">
<h2>Personal Information Form</h2>
<form id="infoForm">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="age">Age:</label>
<input type="number" id="age" name="age" required min="0">
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob" required>
<label for="address">Address:</label>
<textarea id="address" name="address" rows="4" required></textarea>
<input type="button" value="Submit" onclick="submitForm()">
</form>
<div id="info" class="info"></div>
</div>
<script>
function submitForm() {
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const age = document.getElementById('age').value;
const dob = document.getElementById('dob').value;
const address = document.getElementById('address').value;
const infoDiv = document.getElementById('info');
if (name && email && age && dob && address) {
infoDiv.innerHTML = `
<h3>Submitted Information</h3>
<p><strong>Full Name:</strong> ${name}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Age:</strong> ${age}</p>
<p><strong>Date of Birth:</strong> ${dob}</p>
<p><strong>Address:</strong> ${address}</p>
`;
} else {
infoDiv.innerHTML = '<p style="color: red;">Please fill out all fields.</p>';
}
}
</script>
</body>
</html>