0

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.

2
Contributors
1
Reply
16
Views
2 Years
Discussion Span
Last Post by blueshiftdani
0

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.

Edited by blueshiftdani: spelling error

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.