Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Drop down menu problem!

  • 08-02-2006 03: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