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 2 of 2

Thread: select by GET

  1. #1
    Regular Coder sonny's Avatar
    Join Date
    Apr 2008
    Location
    United States
    Posts
    567
    Thanks
    88
    Thanked 0 Times in 0 Posts

    select by GET

    Hi, what is proper way to auto select one
    of these below based on a GET value?

    PHP Code:
    $sel = $_GET['country'];

    <TD>
    <SELECT NAME="LOCATION">
    <OPTION VALUE="<?php $sel ?>">
    <OPTION VALUE="Austria">Austria
    <OPTION VALUE="Denmark">Denmark
    <OPTION VALUE="Germany">Germany
    </SELECT>
    </TD>
    Thanks
    Sonny

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,476
    Thanks
    63
    Thanked 538 Times in 525 Posts
    <OPTION VALUE="<?php $sel ?>" selected="selected">

    No I don't know why selected is not true/false and is the same value as its name.. it's daft if you ask me.
    I can't really think of anything to write here now...


  •  

    Posting Permissions

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