Click here to Skip to main content
15,397,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello. I'm trying to integrate one code piece with multiple choice dependent dropdown list into my contact form. In any case it is shown as simple list until I take off 'multiple' tag. Anybody knows where is the problem?

It should work like this:

And this what it looks like now:

Full index.php:

What I have tried:

<section class="post-content-area pt-20">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 posts-list">
                <div class="card card-signin my-5">
                    <div class="card-body">
                        <h5 class="card-title text-center" style="font-size: 26px">Test contact form</h5>
                        <form method="post" action="email-script.php" enctype="multipart/form-data" id="emailForm">
                            <select id="first_level" name="first_level[]" multiple class="form-control">
                             foreach($result as $row)
                              echo '<option value="'.$row["first_level_category_id"].'">'.$row["first_level_category_name"].'</option>';
                            <select id="second_level" name="second_level[]" multiple class="form-control">

                            <select id="third_level" name="third_level[]" multiple class="form-control">
                            <div class="form-group">
                                <input type="text" name="name" id="name" class="form-control" placeholder="Name" >
                                <div id="nameError" style="color: red;font-size: 14px;display: none">surnameError</div>
                            <div class="form-group">
                                <input type="text" name="phone" id="phone" class="form-control"  placeholder="Phone" >
                                <div id="phoneError" style="color: red;font-size: 14px;display: none">subjectError</div>
                            <div class="form-group">
                                <input type="file" name="attachment" id="attachment" class="form-control">
                                <div id="attachmentError" style="color: red;font-size: 14px;display: none">attachmentError</div>
                            <div class="submit">
                                <center><input type="submit" name="submit" onclick="return validateEmailSendForm();" class="btn btn-success" value="SUBMIT"></center>
Richard MacCutchan 9-Jun-22 6:25am
Look at the source code for the original page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900