So for my website I'm trying to have a page where the user can type in literally anything and the page would output a list of stock symbols that are close to the input. Anything unrealistic (e.g. 3548 random letters) would obviously not work but if the user were to input something like "MS" then the page would output all stock symbols that start with the letters "MS" (i.e. "MSFT", Microsoft, would be one output).

I'm lost in how I can code this. Can anyone steer me in the right directions?

Thank you.

Member Avatar for iamthwee

Are these stock symbols stored in a database?

Member Avatar for diafol

If terms are in mysql - you can search with the LIKE clause.
If terms are in an array, you could search with preg_match().
Either way, do you want this without a page refresh? If so, you can use ajax to populate a faux dropdown. There are loads of online scripts, e.g. autocomplete, autopopulate...

Yes, these stock symbols are stored in a database--a private school database. And yes, these are in terms of mySQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.