473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Select image menu, display in form?

117 100+
Is it possible to use php to load an image in a form when a user selects it from the dropdown box?
I want them to be able to select there avatar but there is way to many to put onto the form so i made a "select menu" with all 45 avatars.
I want it to show the image when selected, so the default (Please choose) shows the image no image selected, and after they pick one lets say avatar_1 it'll show a ghost where the default no image was.

So they can see a preview of it.
I did it using javascript but i really don't like it i hear it is not safe.

I see several sites using this, cheatcc gamefaqs so i know it will work but they use asp..?
Sep 3 '07 #1
1 2812
Atli
5,058 Expert 4TB
Hi Breana.

This can be done in several ways.
The first, and probably the easiest would be to use JavaScript.
If, however, you do not want to use JavaScript (as may don't) you can also just use PHP.

You can have the selection box submit the form by using the onChange event and have your form check whether the Submit button has been pressed. If you do not use the Submit button, it's value will not be sent along with the form.
So, if you can not find the Submit button amongst the $_POST variables, look for the select box. If you find that, change the image according to the selection and set all the other fields according to their respective values in the $_POST array.
If, however, you find the Submit button in the $_POST array, you will know that the user tried to Submit the form. In that case, run the normal submit routine.

Note that this assumes that the action property on the form is pointing to itself.

Hope I've explained that properly :)
Sep 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
1
by: Desigan Chinniah | last post by:
I am presently trying to display a list of items INLINE using an image as a seperator..... and having difficulties.... See below for 3 seperate sets of html and css files. Each set does something...
2
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch...
2
by: jascraig | last post by:
Here's my dilemma. I'm working with a frameset with 3 frames (header,content,control). My control frame contains a select list with buttons for next and previous. When the next button is pushed...
5
by: Jerry | last post by:
Hello! I have an image that uses an image map for navigation. We would like a pull-down menu to appear when the user mouses over the link. The pull-down menu is another image that was created to...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
6
by: mistral | last post by:
I need help adjust CSS image popup, to show big image without javascript. http://moneytreesystems.com/css/picpopup.html I just need move all relevant css to internal style, since I canno use...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.