Results 1 to 5 of 5
Thread: JavaSvript & PHP
-
09-10-2006, 02:07 PM #1Junior Guru Wannabe
- Join Date
- Jun 2006
- Posts
- 76
JavaSvript & PHP
Hi
i write this function , its copy values from database to java array by using php , i got this way from my head , i want to know is there other effective way ?
what i did here is include java code in php script , can i include php in java code ?
i know javascript is client-side and php server-client but i wonder if there is someway to do this ...
<script type="text/JavaScript">
function selectmnue(myselect, myvalue) {
var jmake=new Array();
<?
$i=0;
do{
echo "
jmake[". $i ."] = \"". $row_java_array['MAKE'] ."\";
";
$i++;
}while($row_java_array = mysql_fetch_assoc($java_array));
mysql_free_result($java_array);
?>
//here i want to use these values
}
</script>
-
09-10-2006, 03:53 PM #2Junior Guru Wannabe
- Join Date
- Jul 2006
- Posts
- 95
I usually do the same thing in my code. Sure there will be some other way like Ajax through xml request in javascript.
-
09-10-2006, 10:46 PM #3the cloud is a lie
- Join Date
- May 2004
- Location
- NYC
- Posts
- 793
Yes you can do what you have typed, and it will work.
I've written lots of mixed javscript/php where some of the javascript is generated by php and then used by javascript already in the file, exactly as you are trying to do.
-
09-11-2006, 06:37 AM #4Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
With PHP and Javascript, you could always use the:
PHP Code:<?php echo ...; ?>
-
09-11-2006, 09:47 AM #5Junior Guru Wannabe
- Join Date
- Jun 2006
- Posts
- 76
lol good idea
Originally Posted by horizon
hehe thanks , i really dont know why i don't think in that
its better than used escape chars .. its also confusing me