Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Drop down menu problem!

Options
  • 08-02-2006 3:33pm
    #1
    Closed Accounts Posts: 8,866 ✭✭✭


    I've got a form for users to input data, several text fields which work fine. I need a drop down box that displays machines that the user has based on their session variables from a login page.

    The tables that apply here are tbl_machine and tbl_service_request. tbl_machine contains the machine id's, not the actual machine names, can i still display the machine names in the drop down list? (the machine names are contained in a seperate table named tbl_machine_type)

    when the list displays the machines and the user fills in the form and picks a machine from the drop down list i need it to up the data to tbl_service_request, which stores the text fields and the machine ID that was selected, not the machine name.

    Am i making sense? :D

    This is what i have but its far from correct i know!
    $SQL = "SELECT * FROM tbl_machine INNER JOIN tbl_machine_type WHERE machine_firm_id={$_SESSION} AND machine_customer_id={$_SESSION}";
    $_result = mysql_query($SQL) or die("Query failed : " . mysql_error());
    while($_row = mysql_fetch_assoc($_result)){
    $opt_machine.="<option value={$_row}>{$_row}{$_row}</option>";
    }

    print("<select name=machine_id>$opt_machine</select>");

    ?>


Comments

  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Ok so i got the drop down menu to display what i want, the names of the machines that belong to the company set in the login session variables, but how do i get it to update the table?? Here's what i have:
    $SQL = "SELECT * FROM tbl_machine INNER JOIN tbl_machine_type ON machine_type_id=type_id WHERE machine_firm_id={$_SESSION} AND machine_customer_id={$_SESSION}";
    $_result = mysql_query($SQL) or die("Query failed : " . mysql_error());
    while($_row = mysql_fetch_assoc($_result)){
    $opt_machine.="<option value={$_row}>{$_row} {$_row}</option>";

    }

    print("<select name=machine_id>$opt_machine</select>");


Advertisement