passing variables from php to javascript

From: Date: Tue, 11 Jul 2000 12:06:17 +0000
Subject: passing variables from php to javascript
Groups: php.general 
Request: Send a blank email to php-general+get-5902@lists.php.net to get a copy of this message
I have been working on integrating a small javascript function in with php. I am including the code. Everything works as is, but I also need to pass a variable from the html/php into the javascript function to print out the string length of the text post. Please let me know how this can be done. I have included the code below for suggestions. thanks Keith <? ?> <script language="javascript"> function string_length() { string_count = "4"; alert ("The sequence is " +string_count+ " long"); return; } </script> <form action="mailto.php3" method="post"> <table border="0"> <? for ($i = 1; $i <= $number_of_oligos; $i++): ?> <tr> <td> <? echo ("sequence $i") ?> </td> <td> <input type="text" name="sequence[]"><br><br> </td> <td> <input type="button" name="length" value="How long is my sequence?" onClick="string_length()" <br><br></td> </tr> <? endfor ?> <tr> <td><input type=submit> </tr> </table> </form>

« previous php.general (#5902) next »