Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: fix my php code

  1. #11
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    it's ok to PM me with the access details, I didn't run it against a database, I just set the variable to test the logic of the code

  2. #12
    Join Date
    May 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    PM sent let me know when you can

  3. #13
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    I found a few errors in your code for subcategory2, but this code worked for me.

    PHP Code:
         } else { 
             if (
    $data=='subcategory2') { 
              echo 
    "<select name='subcategory2' >\n"
              echo 
    "<option value='0'>======== Subcategory2 ========</option>\n"
              
    $val2=$val
              
    $val substr($val,0,4); 
              
    $result=mysql_db_query($dbname,"SELECT `subcat_id`, `subcat2` FROM subcategory2 WHERE `subcat_id` = '$val2' AND subcat_id LIKE '$val%' ORDER BY `subcat2` "); 
              while(list(
    $subcat_id$subcat2)=mysql_fetch_array($result)){
                   echo 
    "<option value=\"$subcat_id\" >$subcat2</option> \n" 
              } 
             }
         }
         echo 
    "</select>\n";  
    ?> 
    Fit this into the right place in your code and give it a test

  4. #14
    Join Date
    May 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I switched the code like you suggested and the third drop down menu is now working, however there is no correspondece yet between the selection made in the second drop down with the items displayed in the third...
    I am trying to tweak the code you provided me to see if I can get it to work...
    thanks because it is a great move forward towards the solution...
    Right now I am looking at phpmyadmin for the DB to understand why the other records from subcategory2 are not showing at all...only certain initial records are displayed, indipendently from what selection is made in drop down menu #2

Bookmarks

Posting Permissions

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