Hello, I'm new to PHP and MySQL and would like some help with a small page I'm trying to write which acts as a search page for a user on my site. Ive been working on this for 4 days now and it's driving me insane - mostly because I don't really know what Im doing and I've cobbled the code together from bits of other code, some shoestrings and a cardboard box. I've spent hours going through many different forums and have tried lots of different ways of achieving this, but for some reason I just can't do it The page need to load a list of "categories" and a list of "sectors" from my database and provide three drop down boxes for the user to select. The first drop down box allows the user to select the category, the second allows the user to select a parent ID in the sectors list and I want the third one to allow the user to select a list of sectors whose parent ID matches their selection in the second sector box. e.g. I would have a sector called Backpacker, ID 80 which has a parent sector called Travel, ID 40 (Travel has parent ID 0). I would want to display in the second selection box all those sectors that have Parent ID = 0, and in the third selection box I would to display all sectors that have parent ID based on the second selection box. The user should then press search and this generates a URL to send the user to. I've already written the code to accept the URL and it seems to be working fine, I just need to finish the actual page where the user selects their parameters. I understand I would be best to update the third box is by using some sort of onchange javascript, but I just want to update that third box, and not refresh the whole page. From trawling through forums Ive come up with the code below which provides an old-school Java way of a sort of Ajax functionality of updating the calling page without refreshing it. However I don't really understand the Refresh.php page code and don't know how to change it so my code works. I know that the page is definitely calling SOMETHING when the second box is changed as I've run the script from a USB stick and it lighs up to say something is being access when I change the second box. I'm sorry for the very long code post but I really am new to this (only started building my website 2 weeks ago and had no PHP, Java or MySQL experience before!) My Full Search PHP code looks like this: My ful Refresh.php page (which is from http://www.bestcodingpractices.com/polling_the_server_client_side-31.html and I haven't changed ) looks like this: Any help is much appreciated! Thanks, Moz
Try looking for a lighter code. You're a newbie on php and u use classes and objects, you won't learn it this way. It will get you insane. Look for "ajax multiple selects" or "ajax drop down" or "ajax dynamic drop downs" etc. I'm sure you will find a better example than the above one which is hard to follow by me and everyne that is not so motivated to debug it unless paid Good luck
i agree with manilodisan. As a newbie, I don't think it's wise to work with classes and objects. There would be a lot of examples using ajax to do what you want. Try search here: http://vyk1.spaces.live.com/Blog/cns!EBE3A761F939F926!1051.entry http://www.ajaxtutorial.net/