...

View Full Version : How to display images from file; How to get text box to retain value until new value



dispatch4599
02-24-2010, 04:14 AM
Two general questions.

1. How do I get images that are located in a file to display according to user selection? For example a user chooses Pluto, how do I get the picture that corresponds to their selection to appear.

2. When a user inputs a value into a text box, how do I get the text box to retain that value until the user inputs a new value?

cyrus709
02-24-2010, 09:20 AM
These questions are not very clear but i will surely attempt to answer them.


1)you will need to elaborate here, im at a loss.


2) Is the user navigating away from the page where the text box is at? If yes then you will need to either insert the information in a DB, or in a cookie. Then have the input value be the received information from the db or cookie. If the user does not submit the information but merely types the information, and you would like the text to still be there even though the user navigated away you will need to use ajax and php to insert the text in the db.
If no page navigation, then the value should not change.

dispatch4599
02-24-2010, 03:02 PM
These questions are not very clear but i will surely attempt to answer them.


1)you will need to elaborate here, im at a loss.


2) Is the user navigating away from the page where the text box is at? If yes then you will need to either insert the information in a DB, or in a cookie. Then have the input value be the received information from the db or cookie. If the user does not submit the information but merely types the information, and you would like the text to still be there even though the user navigated away you will need to use ajax and php to insert the text in the db.
If no page navigation, then the value should not change.

Here is my code. It is a single page, just a basic page. I'm sure that my code isn't exactly clean here, but I am just learning. Each time that the user puts in a weight to be calculated and selects a Planet, the program is to display what the weight would be at at that planet and display a picture of the planet below it when it is "submitted". I need the text box to retain its value in case the user does not wish to change the earth weight but only the planet.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum