CodeIgniter Forums
form_dropdown and image load - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: form_dropdown and image load (/thread-31168.html)

form_dropdown and image load - El Forum - 06-09-2010


I want to make this: if I select something from the dropdown list, load image for the selected on the page, so the admin can see what he select.

So I have an newspictures table in my database(ID,status,name,image).

In the dropdown I make a list by name. But I want to show the image when someone choose one from the list.

<? if(set_value('img_id')){
$value = set_value('img_id');
$value = $post['img_id'];
echo form_dropdown('img_id',$images,$value);

I hope you understand it Big Grin

Please helpTongue

form_dropdown and image load - El Forum - 06-09-2010

with o without realoading the page ??
either way ( unless you use a submit button ) you must attach the javascript event onChange to the dropdown, so it loads the image ( via ajax ) or reload the page sending the img id in the uri as parameter.