CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #7
    Join Date
    Jun 2010
    Posts
    11

    Re: Wanto to keep drop down value selected after submit

    PHP Code:
    <?php

    $result 
    mysql_query ("SELECT * FROM $clover_shop_categories WHERE cs_category_title IS NOT NULL ORDER BY cs_category_listing_position asc");

    if (
    mysql_num_rows ($result)) {

        echo 
    "<SELECT name=\"import_category\">\n";

        echo 
    "<OPTION value=\"\">- choose category -</OPTION>\n";
        echo 
    "<OPTION value=\"\"></OPTION>\n";

        while (
    $s mysql_fetch_array ($result)) {

            
    $selected = ($s['cs_category_id'] == $_POST['import_category']) ? "selected=\"selected\"" "";
            echo 
    "<OPTION value=\"$s['cs_category_id']\"$selected>";
            for (
    $i 2$i <= $s['cs_category_level']; $i++) echo "&nbsp;&nbsp;";
            echo 
    "$s[cs_category_title]</OPTION>\n";

        }

        echo 
    "</SELECT>\n";
        
    }
    ?>
    Like this?
    Result is a blank screen.
    Last edited by Temporary-Failure; June 14th, 2010 at 01:13 AM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured