You are here: Re: [PHP] php and javascript « PHP « IT news, forums, messages
Re: [PHP] php and javascript

Posted by Marek Kilimajer on 04/11/05 02:32

PartyPosters wrote:
> Hello, I have a form that when I hit sumbit I want to test the varialble in javascript. I can get it working using test variables in php but I want to be able to call the input box in my form, the only problem is the name of the box is in an array (i think) as it's in a list. You can see the 2 samples of the code below which will hopefully make more sence.
>
> Can anyone help me out?
> Thanks.
>
> <head>
> <SCRIPT language=JavaScript>
> function checkdata() {
> alert(document.Selection.quantity[0].value)
> alert("TEST")
> return true
> }
> </SCRIPT>
> </head>
> ---------------------------------------------------------------
>
> while ($row=mysql_fetch_array($mysql_result))
> {
> echo "<TR>
> <INPUT NAME = \"distID[]\" TYPE = \"HIDDEN\" VALUE=\"$distID\">
> </TR>";
> }
>

Assuming your form is named "Selection", you will have a javascript
array document.forms['Selection'].elements['distID[]'] available. You
can try:

alert(document.forms['Selection'].elements['distID[]'][0].value);

 

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

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