Forum Moderators: coopster

Message Too Old, No Replies

character "[" is not allowed in the value of attribute "ID"

Parse error in validation result

         

tito

11:14 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



Hello,

By validating my pages i get:

character "[" is not allowed in the value of attribute "ID"

concerning this piece of code:

<input name="group" type="hidden" id="group[]" value="1">

How can i solve it?
Thanks in advance,
tito

sned

11:22 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



Hmm, I think that id's have to be just text or numbers, however, are you trying to pass an array of values?

If so, put the [] after the name:

<input name="group[]" type="hidden" id="group" value="1">

-sned

tito

11:35 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



Hi Sned, it gets validated like that, but i get:
Unknown column 'Array' in 'field list'

jatar_k

11:40 pm on Jul 15, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I believe it is supposed to be name="group[]" not in id

tito

11:48 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



sorry i don't get it

jatar_k

12:03 am on Jul 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



instead of

<input name="group" type="hidden" id="group[]" value="1">

I believe it should be

<input name="group[]" type="hidden" id="group" value="1">

or maybe just

<input name="group[]" type="hidden" id="35" value="1">

tito

12:21 am on Jul 16, 2005 (gmt 0)

10+ Year Member



none of above are working

jatar_k

12:24 am on Jul 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I relaize you are trying to get the pages to validate, but what is the logic this element represents? What are you actually trying to do? Why the array for a hidden element?

tito

12:28 am on Jul 16, 2005 (gmt 0)

10+ Year Member



it's a newsletter script and the failing code belongs to the sub/unsub form:

<?php include("/mail/globals.php");?>
<form action="<?php echo $website.$relative_string;?>" name="subscribe" onsubmit="javascript:return checkEmail(this);" method="post">
<label>Join the Newsletter</label><br>
<input name="subscribe" type="radio" value="true" checked>
Subscribe<br>
<input type="radio" name="subscribe" value="false">
Un-Subscribe<br>
<input name="email" type="text" class="field" id="email2" value="Your email address" size="26" onfocus="this.value='';" >
<input name="group" type="hidden" id="group[]" value="<?php echo $group;?>">
<input name="Submit2" type="submit" class="field" value="Submit"></form>

jatar_k

12:32 am on Jul 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why not just

<input name="group" type="hidden" value="<?php echo $group;?>">

tito

12:52 am on Jul 16, 2005 (gmt 0)

10+ Year Member



Thanks so much jatar_k
now it's working and validated