Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-06-2011, 04:56 AM   PM User | #1
mingqi
New to the CF scene

 
Join Date: Apr 2011
Posts: 8
Thanks: 5
Thanked 0 Times in 0 Posts
mingqi is an unknown quantity at this point
autocomplete, php, and mysql

Hello!

I hope you can help me! I had posted a question to the php forum that a responder had suggested should go in this forum. I know nothing abt ajax (though I have some javascript experience from what seems to be another lifetime ago), so I apologize if I sound completely clueless.

My question:
I am working on a form tracking courses to a professor. The code I have written now allows me to pull up any existing courses entered into the database into a dropdown menu. The user can select an existing course or, if the course doesn't exist, hop on over to another field an add a course to the database.

Is there a way I can streamline this so that I can select and add in the same field? I've been looking at bit at mentions of autocomplete, but I'm not sure if it is possible for each autocomplete suggestion to associate itself with the records in my mysql database and for it to create a new course record when the course is new?

I don't need a code or anything, but if you could let me know if it's possible and maybe even point me in the right direction, it'd be great!

Thank you so much!
mingqi is offline   Reply With Quote
Old 06-06-2011, 04:48 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
It is possible to do this and it's called a 'combo box'. Ajax can be used to send the new course title back to the database to be added. So it's a combination of

PHP to populate the page and the select list
JavaScript or Ajax to AutoComplete the user's selection
JavaScript to handle when they type a new course title
Ajax to send the new title to the server
PHP to receive and store this new value in the database.

If you search for 'JavaScript combo box' you will find a number of scripts, but finding one that combines all these steps might be trickier.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
mingqi (06-13-2011)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:51 PM.


Advertisement
Log in to turn off these ads.