Cleaning Up Some PHP And Incorporating A JavaScript-Based Image Preview
Recently asked on Yahoo! Answers:
Change image when new option selected in PHP?
This probably will also require Javascript. I am using this code:
What it does is draws from a MySQL database where an “avatars” table is set. The “avatars” table includes fields “id” (INT), “title” (VARCHAR) and “url” (VARCHAR).
Basically, the script draws the rows from the table. It puts the titles in an HTMLselectform asoptions.{code block snipped}
When an option is selected, I would like the image that is selected to be shown, without a new page having to be loaded.
This is very easy to do with JavaScript and DOM manipulation, but based on the user’s code, it requires a bit more work that previous blog entries I’ve made on images and JavaScript.
Let’s start with looking at the original code block.
Continue reading ‘Cleaning Up Some PHP And Incorporating A JavaScript-Based Image Preview’ »