Hi Everyone.

I have a page were I need to give the viewer the option to add their choice to a shortlist. Is it possible to do this in a pure PHP / MySQL environment?

Regards

Recommended Answers

All 4 Replies

Member Avatar for Zagga

Hi LRNPHP,
I am a little unsure as to what you are actually asking here.
If you have a list of items (for example apples, oranges and pears) you could store the list in a database and then add the users choice (for example bananas) to the list with very simple PHP & MySQL.

Do you have a specific example?


Zagga

Hi LRNPHP,
I am a little unsure as to what you are actually asking here.
If you have a list of items (for example apples, oranges and pears) you could store the list in a database and then add the users choice (for example bananas) to the list with very simple PHP & MySQL.

Do you have a specific example?


Zagga

Hi Zagga.

I have a site that I'm running with PHP / MySQL. He will do a search for what he want's (all the info is being pulled from the DB and displayed). On the search results page it will give him a option to add up to 5 search results to a shortlist that he can email to himself and me.

Hope it is understandable. Thanks Again.

Regards

Read the info from the db into a form where each item each has a checkbox. You will give each item a standard name plus an index number (i.e. name=aaaa$i). In the module that processes the form data, you process the items one at a time in a loop treating them as variable variables and then copying them to a standard variable name that the rest of the processing uses. You could add each of the chosen items to a string and when you're done, insert that string into an email that you send to him and to yourself. All of this is pretty straightforward PHP. If you haven't used variable variables you might find it a bit confusing but the actual code to do it is quite simple.

With respect to "pure PHP and MYSQL" the only considerations come in if the list of items is to be paginated because it is too long for one page; or, if you want to be able to limit him to 5 items as they are being chosen. In both cases, you might want some javascript but it could be handled in a less elegant way with PHP.

Shortlist????What it means?????????What are you going to shortlist???????
-------------------------------------------------------------------------------------

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.