Re: [PHP-DB] PHP with Javascript tutorials?

2004-06-25 Thread Ben Riddell
Hi Chris,
Sorry I can't give you a more full response right now (or the actual code..).
View source from this little form that I built:

It's just a proof of concept, but uses javascript arrays.  A friend of mine 
said he turned the above simple script into modules for both Perl and 
PHP.  I'll check with him to see if they are done and available.

I've been working on a more complicated set of dropdowns that is very 
similar to the sample you described.  I decided against preloading all of 
the arrays, because each one has to be generated by a db call (it's a 
college alumni database, and it only pulls states/counties/provinces where 
alumni actually reside).  So instead of all the db calls and the huge array 
of arrays, I added a javascript onSelect() call to the country drop down 
which actually submits the form, but changes the action of the form to the 
form itself and then adds a new dropdown for state/country/province (and 
preserves anything entered in the other form field elements).

Let me know if you think you need the second option or more Javascript 
details for the first option.

HTH,
-Ben Riddell
At 11:33 AM 6/25/2004, Chris Payne wrote:
Hi there everyone,

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.

Any help would be EXTREMELY greatly received :-)

Regards

Chris

--- Ben Riddell 
-- Freelance Web Developer -
--- [EMAIL PROTECTED] ---
--- www.thewhitebear.com ---
--- 510/332.2979 ---



Re: [PHP-DB] PHP with Javascript tutorials?

2004-06-25 Thread jeffrey_n_Dyke



> 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

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



[PHP-DB] PHP with Javascript tutorials?

2004-06-25 Thread Chris Payne
Hi there everyone,

 

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.

 

Any help would be EXTREMELY greatly received :-)

 

Regards

 

Chris



Re: [PHP-DB] PHP with Javascript

2003-07-14 Thread Peter Monk
I have a problem
Chris, JavaScript is what you need.  I can recommend this site to you:
http://developer.irt.org/faq.htm
It has a huge amount of info on JavaScript (and other languages, too).

Peter.

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


[PHP-DB] PHP with Javascript

2003-07-14 Thread Chris Payne
Hi there everyone,

I have a problem, I am populating my first dropdown box on my form from my MySQL DB 
with PHP no problem, but when I select the item it has to refresh the whole page to 
put the items into the second dropdown box, is there an EASY :-) way of populating the 
second box with Javascript so that the page doesn't have to refresh?

I'm a total Jscript newbie, but I figured that Jscript is what I need to use with PHP 
and MySQL to achieve this?  I know this is somewhat about Jscript but it's also about 
PHP and MySQL :-)  I just need to find the best way to populate the second box without 
having to refresh the whole, page so any ideas/examples would be very welcome :-)

Thanks for everything.

Chris