hi! Can u please tell me whats wrong with my codes cause it doesn't work and I don't see where I went wrong.I have a page with two select fields where the second select field is populated with the values depending on the selection made in the first field.And this page refers to a php page which I refered it as a javascript page as shown below
Your browser should have been indicating errors (line numbers/character positions) in the javascript.
To start with <br> is not valid javascript. Remove all of them in reference.php.
The following line is missing a double-quote -
Code:
addList(\"Nissan\", \Safari\");
The header() statement is not necessary.
And I recommend using the HEREDOC syntax so that you don't need to do things like escape all the double-quotes (which is probably how the double-quote got lost.) The following worked for me -
If you copy/paste the above, make sure that the EOT; at the end has nothing else on the line with it. The forum software usually adds a space at the end of the line and this will prevent the code from working.
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.