Hello,

I have two mysql tables, the first one for salutation (salutationId, SalutationTitle) and the second one for clients (Id, FirstName, LastName, salutationId) . I can do the dropdown list from salutation which contais (Mr., Ms. ...etc) in a regitration form and insert the data to mysql without problem. Here is the code for the dropdown:

            <form action="" method="post">
                <div class="modal-body">
                    <div class="row">

                <div class="col-md-5">
                    <div class="form-group">
                    <label for="salutationId"><?php echo $SalutationName; ?></label>
                    <select class="form-control" name="salutationId">
                    <?php
                        // Get the Salutation List
                        $sqlStmt = "SELECT salutationId, SalutationTitle FROM salutations";
                        $results = mysqli_query($mysqli, $sqlStmt) or die('-2'.mysqli_error());
                    ?>
                        <option value="..."><?php echo $selectOption; ?></option>
                        <?php while ($row = mysqli_fetch_assoc($results)) { ?>
                        <option value="<?php echo $row['salutationId']; ?>"><?php echo clean($row['SalutationTitle']); ?></option>
                        <?php } ?>
                    </select>
                    <span class="help-block"><?php echo $selectSalutationFieldHelp; ?></span>
                    <input type="hidden" name="SalutationTitle" id="SalutationTitle" />
                </div>
         </div>    

Now, I have another form to update client list, and I need to get the dropdown values and change what i need (ex: Change from Mr. to Ms.) then update the salutationId in clients table.

Thank you.

You have not added the code for inserting salutation ID. You may use string concatenation like:

."$SalutationTitle".+."ClientName".

Use join to get the values ffrom both tables at the same time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.