For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > June 2004 > Re: [PHP-DB] PHP with Javascript tutorials?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] PHP with Javascript tutorials?
Jeffrey N Dyke

2004-06-25, 3:55 pm




> Hi there everyone,

Hello.
> I've been looking on Google for PHP Javascript tutorials but I can't find
> any. I'm new to Javascript but can use PHP for what I need. I was

hoping
> someone would know of a tutorial that would show how to use PHP to get

2-3
> datasets which javascript can then use in forms. For example, say I have

3
> pulldown boxes, one would have countries - such as UK, USA etc .. If you
> selected the UK it would bring up countries in the UK, and if you select

a
> country the third pulldown would show the cities in that country (This is
> just an example to hopefully explain what I need) but I don't want the

page
> to refresh everytime I select an option which it does if you just use

PHP.

Since they are two seperate languages, all you can really do is use PHP to
write dynamic Javascript or assign values to javascript variables with
php.. if you want the drop downs to be dynamic then you'll need to write a
function that makes a database call, gathers all the data and then writes
it to static arrays in a file that you can then read with Javascript and
create the drop downs from the arrays.

They are seperate, don't think of them as being able to work together to
much. except that you can build JS using PHP.

HTH
Jeff
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com