validating and processing..

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
zinc
Forum Newbie
Posts: 15
Joined: Fri Feb 10, 2006 1:02 am

validating and processing..

Post by zinc »

hi,

i need some help.....
currently, i have a form consisting of some chekboxes....

<td>a <input type="checkbox" name="services" value="a" /></td>

<td>b <input type="checkbox" name="services" value="b" /></td>

<td>c <input type="checkbox" name="services" value="c" /></td>

<td>d <input type="checkbox" name="services" value="d" /></td>

<tdeG <input type="checkbox" name="services" value=G" /></td>

<td>f <input type="checkbox" name="services" value="f" /></td>

i'm doing a validation using javascript...and after the validation i'm suppose to do a $_POST[services]
but for php to display the value the checked checkboxes, the name of the checkboxes must be declared as name="services[]"....with the array box....but if i put the array box, i will not be able to do validation using javascript......

can anybody help??

thx,
zinc
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

big hint:

Code: Select all

document.forms['yourFormName'].elements['services[]']
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

Code: Select all

<td>a <input type="checkbox" name="services[]" value="a" id="services" /></td>
javascript

Code: Select all

services = document.getElementById('services');
//do all your fun js stuff here
best of both worlds.
Post Reply