Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Closed Points: 25 Time: 06:24 - Sep 27, 2007  

shashi.programmer

how to create multiple browse row for upload

i have create a row in which 4 colum two of them is drop down one is date and last one is browse a file to upload. now i need that when i click a button this should add new row with same controls.

<table>
<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">HSP</font></td>
<td>
<select name="hname">
<option value="">HSP</option>
</select>
</td>

<td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Report Type: </font></td>
<td>
<select name="rname1">
<option value="">Report Type</option>
</select>
</td>


<td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Date of Report: </font></td>
<td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Upload File: </font></td>
<td><input name="uploaded" type="file" /></td>
<td><input name="add" type="submit" value="Add New Record" /></td>
</tr>
</table>


on click over add new record button the complete table should be created in second row

thanks & regards
Shashidhar Kumar

Categories

Answer Discussion
Tutorials

 

jgivoni

Date:: Oct 19, 2007

Time:: 11:42

You could try something like this:

Change the first lines to:
<table>
<tr id="record">
...

Change the button to:
<input name="add" type="button" value="Add New Record" onclick="addNewRecord()"/>

Add this javascript function somewhere:

function addNewRecord()
{
 var record = document.getElementById("record");
 var no = record.childNodes.length;
 var newRecord = record.cloneNode(true);
 newRecord.id = "record" + no;
 newRecord.value = "";
 newRecord.name = "uploaded" + no;
 record.parentNode.appendChild(newRecord);
}

shashi.programmer

Date:: Oct 29, 2007

Time:: 23:35

not sufficient

shashi.programmer

Date:: Oct 29, 2007

Time:: 23:36

i have done it

jgivoni

Date:: Oct 30, 2007

Time:: 01:57

What? You need more help? If so please specify.

internisti007

Date:: Dec 13, 2007

Time:: 21:22

It's cool. Btw,how delete record with on click

Question Answered

This question has been closed, and points have been rewarded to the following experts:


jgivoni: 10
shashi.programmer: 15

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

shashi.programmer

Date:: Sep 03, 2009

Time:: 04:02

<?php
/***********************************************
* Snippet Name : Multiple File Uploader *
* Scripted By : Shashidhar Kumar *
* Website : http://www.shashionline.in *
* Email : shashi@shashionline.in *
* License : GPL (General Public License) *
***********************************************/

$working_folder = $_SERVER['DOCUMENT_ROOT']."/upload/";
if(IsSet($_POST["submit"])) :
 $xx = 0;
 while($_POST["TOTAL_FILE"] >= $xx) :
  @$fileName[$xx] = $_FILES['theFile']['name'][$xx];
  @$tmpName[$xx] = $_FILES['theFile']['tmp_name'][$xx];
  @$fileSize[$xx] = $_FILES['theFile']['size'][$xx];
  @$fileType[$xx] = $_FILES['theFile']['type'][$xx];
  move_uploaded_file ($tmpName[$xx], $working_folder.$fileName[$xx]);
  $xx++;
 endwhile;
 print "Upload successful";
endif;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-t...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
<!--
function add_more_upload() {
 var new_total = Math.round(document.Uploader.TOTAL_FILE.value) + 1;
 document.getElementById('attach_' + document.Uploader.TOTAL_FILE.value).innerHTML = "<input type='file' size='60' name='theFile[" + new_total + "]' /></p><p id='attach_" + new_total + "'>";
 document.Uploader.TOTAL_FILE.value++;
}
-->
</script>
</head>

<body>
<form action="upload.php" name="Uploader" method="post" ENCTYPE="multipart/form-data">
File to Upload: <p id='attach'><input type="file" size="60" name="theFile[0]" /></p>
<p id='attach_0'></p>
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
<input type="hidden" name="TOTAL_FILE" value="0" /><br />
<input type="submit" name="submit" value="Upload" />
<input type='button' value='Upload More' onClick="add_more_upload()" />
</form>
</body>
</html>


Click here to see the Answer Discussion that preceded this tutorial.


Login to rate this tutorial: Good  |  Bad

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10279

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es