Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 62f4ebd

Browse files
Create uploadform.php
The form for upload
1 parent f485bec commit 62f4ebd

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

‎uploadform.php‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
<?php
3+
4+
if (!isset($_POST['add_account'])) {
5+
6+
?>
7+
8+
<form method="post" action="" enctype="multipart/form-data">
9+
10+
<p id="add_field"><a class="btn btn-default" href="#">Add Rows</a></p>
11+
<table id="myTable">
12+
<thead>
13+
<tr>
14+
<th>#</th>
15+
<th>First Name:</th>
16+
<th>Last Name:</th>
17+
<th>E-mail:</th>
18+
<th>Upload file</th>
19+
<th></th>
20+
</tr>
21+
</thead>
22+
<tbody id="container">
23+
</tbody>
24+
</table>
25+
26+
<input class="btn btn-default" type="submit" name="add_account" value="Submit" />
27+
</form>
28+
29+
30+
<?php } ?>
31+
32+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
33+
<script type="text/javascript">
34+
35+
$(function(){
36+
var counter = 0;
37+
$('p#add_field').click(function(){
38+
counter += 1;
39+
$('#container').append(
40+
'<tr><td>' + counter + '</td><td><input name="fields['+counter+'][first]" type="text" placeholder="First Name" required/></td><td><input name="fields['+counter+'][last]" type="text" placeholder="Last Name" required/></td><td><input name="fields['+counter+'][email]" type="email" placeholder="email" required/></td><td><input id="userfile" name="fields['+counter+'][file_uploaded][]" type="file" /></td><td><input type="button" value="Remove" onclick="delRow(this)"></td></tr>');
41+
42+
});
43+
});
44+
45+
function delRow(currElement) {
46+
var parentRowIndex = currElement.parentNode.parentNode.rowIndex;
47+
document.getElementById("myTable").deleteRow(parentRowIndex);
48+
}
49+
50+
</script>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /