You are here: Re: Grabbing checkbox values « PHP Programming Language « IT news, forums, messages
Re: Grabbing checkbox values

Posted by Michael Fesser on 11/13/06 17:48

..oO(Amer Neely)

>When you say it 'work's, does that mean your PHP tells you upon form
>submission which boxes were checked?

Yep. The problem with your script was the operator '=~', which doesn't
exist in JS. Use a '==' and it works.

>Mine works fine IF AND ONLY IF I
>check the boxes with the mouse, even though the JS code will toggle them
>on or off perfectly.

The problem was this part:

document.forms[0].elements[i].name =~ 'DeleteThis'

'=~' is not an operator recognized by JS. It is interpreted as an
assignment operator, followed by a bitwise negation of its operand!

I don't know for sure what the JS engine does if you try to negate a
string, but it look as if it's casted to an integer first, which is 0 in
this case. After bitwise negation it became -1 (two's complement), which
then got assigned to each control's name. A simple

var_dump($_POST);

at the beginning of the PHP script shows that.

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация