Avatar of brianbish
brianbish
 asked on

How do I pass an array via HREF using document.getElementById().value

How do I pass an array via HREF using document.getElementById().value and an Onclick event?
<script language="javascript" type="text/javascript">
function subcatid(x) {
var var1=x;
window.location.href = ( 'manage_products.php?var1='+var1);
}
</script>
<html>
<body>
<table> 
<tr>
                                    <td >Image 1: <input size="40" type="file" name="file[]" id="image1"/>									</tr>
                                        <tr>
 
                                      <td >Image 2:
 
                                      <input size="40" type="file" name="file[]" id="image2" /></td>
                                    </tr>
 
                                    <tr>
 
 
                                      <td >Image 3:
 
                                      <input size="40" type="file" name="file[]" id="image3" /></td>
                                    </tr>
 
                                    <tr>
 
                                      <td >Image 4:
 
                                      <input size="40" type="file" name="file[]" id="image4" /></td>
                                    </tr>
 
                                    <tr>
 
                                      <td >Image 5:
 
                                      <input size="40" type="file" name="file[]" id="image5" /></td>
                                    </tr>
 
                                    <tr>
 
                                      <td >Image 6:
 
                                      <input size="40" type="file" name="file[]" id="image6" /></td>
                                    </tr>
 
                                    
                                     
</table>
  <input name="submit" type="button" value="Add"  onclick="subcatid(file[])"/>
 
</body>
</html>

Open in new window

JavaScriptScripting LanguagesPHP

Avatar of undefined
Last Comment
hielo

8/22/2022 - Mon
ChetOS82

What you are asking for doesn't make sense.  What are you trying to accomplish?
SOLUTION
hielo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
brianbish

ASKER
Can I do this inside the html:

<script>
var im1=file[0];
var im2=file[1];
var im3=file[2];
var im4=file[3];
var im5=file[4];
var im6=file[5];
</script>

<input name="submit" type="button" value="Add"  onclick="subcatid(im1, im2, im3, im4, im5, im6 )"/>
 


ASKER CERTIFIED SOLUTION
hielo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes