hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : JavaSvript & PHP
Reply

Forum Jump

JavaSvript & PHP

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
Junior 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>



Sponsored Links
  #2  
Old
Junior 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.

  #3  
Old
the 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.

Sponsored Links
  #4  
Old
Web Hosting Master
 
Join Date: Mar 2006
Posts: 961
With PHP and Javascript, you could always use the:

PHP Code:
<?php echo ...; ?>
command between your JS codings.

  #5  
Old
Junior Guru Wannabe
 
Join Date: Jun 2006
Posts: 76
lol good idea

Quote:
Originally Posted by horizon
With PHP and Javascript, you could always use the:

PHP Code:
<?php echo ...; ?>
command between your JS codings.

hehe thanks , i really dont know why i don't think in that
its better than used escape chars .. its also confusing me

Reply

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?