Hello people i'm new to the forum and my experience with PHP is very small in fact I only know how to echo some text. So I'm as new as they get.

However I want to create a little program for my website and just need to know firstly.
Can this be done in PHP?
And how would I do it roughly?

Heres the task:

I want a page which contains about 6 drop down boxes but depending on what you choose in the drop down boxes depends on what text is posted at the end.
Each drop down box would have about 5 different options.

So for example if it was a website on the subject of food, you might select eggs in the first field. The box would then display a sentence which says "You can't make much with that on it's own.".
In the second box you'd select flower maybe and the text would change and maybe also provide a helpful pointer.

I'm not sure if this is a PHP or a JAVA task. I don't know either but I would learn once I know which direction I'm going in.

Many thanks

6 Years
Discussion Span
Last Post by _coder

PHP runs on the server so before it can respond to what the user enters in the browser, which runs on the client, the client must post something to the server.

Javascript runs in your browser on the client, so it can respond to events such as the user typing data, clicking mouse, moving mouse pointer over an object, etc. independently of what or when data is posted to the server.


Thank you very much.
Javascript it is then. It is something I've always wanted to learn and now I have an excuse to do so.


But if the client disabled the javascript you will have to validate it with PHP or it can couse bad info saving !


But if the client disabled the javascript you will have to validate it with PHP or it can couse bad info saving !

Right. One downside to javascript or any other client-side scripting is that the user may have configured his or her browser not to run scripts. When you study javascript, you will learn how to design your page to take into account what a user will see if javascript is disabled: either an alternative (no-frills) way of posting the data and having it validated on the server (by PHP or some other server-scripting language), or just a message telling the user to enable javascript on their computer if they want to use your web-site.

Another point about javascript is the user can view the page source and see your javascript scripts, copy some of your coding techniques and gain an undeserved reputation as a great javascript programmer.:) (I've never had to worry about that.) Whereas the user can't see scripts that run on the server, such as PHP scripts.


If it's really that big, downloading the entire CONTENT (food matched against subfoods, matched against subsubfoods) could make downloading the page quite slow.

The way out:

Use Ajax (Simply put, Javascript used such that [in this instance], when a user selects a food, a request is sent to a php script that checks the necessary values on the server (MySQL, maybe) and sends only a SMALL chunk of data containing the subfoods, and so on...

With this, you can design your page to fall back to traditional PHP transport means if Javascript is disabled!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.