Jump to content

Javascript form field with same name for PHP


jamina1

Recommended Posts

Hi all!

 

I'm kinda newish to Javascript, and it's not wanting to play nice with my PHP code.

 

I have a form set up like this:

<input type="text" name="startdate[]" id="startdate1">
<input type="text" name="startdate[]" id="startdate2">

The fields must have the same name because I want PHP to parse them as an array.

In javascript when I use document.getElementById('startdate1'), it always sees the name of the field, so when I try to pass a value back to it, it sends an error because it tries to assign a value to 'startdate[]'

The fields must be named as they are.. is there a way to tell javascript to use the ID, rather than the name?  ???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.