Re: php and javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux