Buy Sell Discuss UK Domain Names at AcornDomains.co.uk Free Virtual Servers

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 12:39:00 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 20-12-2008, 07:52:36 PM     #1 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,586
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

multiple autofill dropdowns from db -php quesion

Ok a bit tricky to explain but hopefully someone will understand me and can help


I have a series of 3 dropdown boxes.
You selct and option from the first and it updates the options in the second drop down.
You then select an option in the second and it fills the options in the third drop down.

Now I've managed to create all of this with javascript code. But this is with the all of the options and information being in the html. So anyone can view source and see all of the options which I'd prefer not to happen.

That's the first and smaller issue. The second issue is that my test script (javascript) which achieves the above, is only for a few 50-ish entries for each dropdown. My final project could have a few thousand entries in a db that I would need to display as entries, and as entries are added to the database I would want these options to be automatically available for people to select in the dynamic form...

I'm looking for a solution which the entire database wouldn't be exposed by people viewing the source of the page.

I think if javascript is used (even by php pulling the the information by arrays to create the javascript) then this information would be exposed. Or is there a way to hide the javascript code (containing the db info) inside the page header or hiding it somehow in the body.

Or should I forget javascript altogether and just do something with php and reloading the page...

A bit of a tricky one - any thoughts appreciated...
woopwoop is offline  
Old 21-12-2008, 02:30:57 AM     #2 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

The only way you could do this would be using AJAX, so your Select Box2 OnChange would pass selectbox1's value to the script process it and return the results, your javascript would then populate box2 and so on.

My AJAX sucks and outsource it, but a little search on the net for PHP Ajax will set you right.

Oh yeah because you are using javascript to run a php query and then pulling it back into html means you don't need to convert the page to php because the java will work between the php and html. The database will need to be mysql and the population/query will need to be php but the calling page with the ajax in can be html.
__________________
Browse:
Skinner is offline  
Old 21-12-2008, 09:19:12 AM     #3 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,586
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

Thanks skinner I'll look into ajax, and try and find a script, just have no experience of ajax so if there's another way to do it with javascript and php alone it would be a better solution for me.

The database is mysql. And I know that if I just use php alone then I'll need page reloads on each dropdown selection with php being server side.

My solution so far with php gathering all the options from the database and loading them into the javascript code should work, but my big convcern is having the whole database available to anyone who views the source of the page. (plus there are a lot of options pulled from the db).

Maybe your suggestion of ajax will do this in a secure and fast way - any tips? I'll do a few google searches.
woopwoop is offline  
Old 21-12-2008, 02:53:57 PM     #4 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

Build an Ajax Dropdown Menu - Webmonkey
Skinner is offline  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
Self Appraisal of Domains Blake Domain Research 2 05-10-2007 08:13:34 PM

Web Hosting from UK2 from just 99p


All times are GMT. The time now is 12:39:00 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".