Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How to display images from file; How to get text box to retain value until new value

    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?

  • #2
    Regular Coder cyrus709's Avatar
    Join Date
    Dec 2008
    Posts
    102
    Thanks
    22
    Thanked 5 Times in 5 Posts
    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.
    Last night I lay in bed looking up at the stars in the sky and I thought to myself, where the heck is the ceiling.

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by cyrus709 View Post
    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.
    Last edited by dispatch4599; 02-24-2010 at 10:36 PM. Reason: figured it out myself


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •