-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
45 lines (45 loc) · 1.94 KB
/
index.html
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
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<ul>
<li><a href="">Home</a></li>
<li><a href="displaydata.php">E-Library</a></li>
<li><a href="http://alapan.me" target="_blank">Visit My Blog!</a></li>
</ul>
<div class="form-style-6">
<h1>Alapan's E-Library Book Input Portal</h1>
<form method="POST" action="connection.php" enctype="multipart/form-data" onsubmit="return validate(this)">
<input type="text" id="name" name="bookname" placeholder="Book Name*" required/>
<textarea cols="25" rows="4" name="bookdesc" placeholder="Book Description*" required></textarea>
<input type="text" id="password" name="bookauthor" placeholder="Book Author*"/ required>
<select name="booklang" required>
<option selected disabled>Select Book Language*</option>
<option value="English">English</option>
<option value="Hindi">Hindi</option>
<option value="German">German</option>
<option value="French">French</option>
<option value="Other">Other Language</option>
</select>
<div style="padding-bottom: 6px"><label>Select Book* (Only Pdf, Doc & Docx files are allowed)</label></div>
<input type="file" name="bookfile" id="bookfile" required/>
<input type="text" id="name" name="uploadername" placeholder="Uploaders Name*" required/>
<input type="email" id="name" name="uploaderemail" placeholder="Uploaders Email*" required/>
<input type="submit" id="submit" name="submit">
</form>
</div>
</body>
</html>
<script>
function validate() {
var val = document.getElementById('bookfile').value.toLowerCase();
var regex = new RegExp("(.*?)\.(docx|doc|pdf)$");
if(!(regex.test(val))) {
document.getElementById('bookfile').value = '';
alert('Please select correct file format.');
return false;
}
return true;
}
</script>