Grab Values From URL, Place Them On The Page

Discussion in 'Programming' started by Letcha, May 19, 2009.

  1. #1
    Is there any easy way to do this?

    I have an html form and I'd like some of the field to be populated by the URL. So if the URL was example.com/form.php?email=stevecase@aol.com&color=blue

    The email field would then contain 'stevecase@aol.com', and the color field would contain the text 'blue'.

    I'm not sure if you'd use PHP, javascript, or a combination of both to do this. Can this be accomplished without working with SQL databases? It seems like it should be possible, since the info is just being pulled from parameter values in the URL.

    Any assistance here would be much appreciated. Thanks!
     
    Letcha, May 19, 2009 IP
  2. Tom12361

    Tom12361 Active Member

    Messages:
    442
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Tom12361, May 19, 2009 IP
  3. Host Storm

    Host Storm Peon

    Messages:
    108
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Enjoy, I wrote the code for you... Just follow the directions...

    Insert this above the HTML Form:

    <?php
    
    $email = $_GET['email'];
    $color = $_GET['color'];
    
    ?>
    Code (markup):

    Insert this in the html form. Some modification may need to take place to fit the style your looking for, but you probably have got that covered.
    Email: <input type="text" name="email" value="<?php echo $email; ?>" /><br>
    Color: <input type="text" name="color" value="<?php echo $color; ?>" /><br>
    Code (markup):
    Enjoy, If it helps I'm glad to be of service.
     
    Host Storm, May 19, 2009 IP