SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html select, and inserting to var. ?!

    Hi all again !

    now i just wanna know this, i have html select which will sort the sub_cat, sub_cat_id, and catagory :
    PHP Code:

    $sql_cat
    ="select * from subcat";
    $result_cat=@mysql_query($sql_cat,$db);

    echo 
    "<select name=\"newsub_cat\">";

              while(
    $mycat=@mysql_fetch_array($result_cat))
        {

    $sub_cat=$mycat["sub_cat"];
    $sub_cat_id=$mycat["sub_cat_id"];
    $catagory=$mycat["catagory"];

      echo
    "<option value=\"$sub_cat\">:: $catagory  :::  $sub_cat :::  $sub_cat_id ::</option>";

    }


    echo
    "</select>";
    ?> 
    with this way i can insert just the sub_cat, i need to insert the catagory also into another table which include catagory and sub_cat field ?

    i was trying with this :

    PHP Code:
    $query mysql_query("Select catagory from subcat where newsub_cat='$sub_cat'",$db);
    list(
    $sub_cat_id$sub_cat$catagory) = mysql_fetch_row($query);

    echo 
    "[$catagory$newsub_cat";
    $newcat=$catagory
    but didn`t work !
    Last edited by Richi; Aug 13, 2001 at 03:42.


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
  •