compare to database

I have a page with two drop down list with information in each of them coming from a database. There is also a post button on the same page. What I want is that as soon as the user clicks the button to “read” the selected values and according to those values take them to a certain page, for example:
if user selects “Florida” from dropdown list # 1 and “Hot” from dropdown list #2, it should take them to file flahot.html.
if user selects “Texas” from dropdown list # 1 and “Cold” from dropdown list #2, it should take them to file texascold.html
and so on. Here is my code so far…
index.php
html>

Drop Down


<?php
// include configuration file.
require ‘mysql.conf.php’;

        // connect to db
        mysql_connect(DB_HOST, DB_UNAME, DB_PWD) or die('Database error!!');
        mysql_select_db(DB_NAME);
        
        // get table `personal` result resourse
        $r = mysql_query('SELECT * FROM `country`'); 
    ?>
    
    <form name='get_state' action='post.php' method='POST' >
        <div id='country_container' style="float:left">
            <select name='country' onchange="window.loadStates()">
                <option enabled>Select Personal</option>
                <?php while($row = mysql_fetch_assoc($r)): ?>
                <option value='<?php echo $row["c_id"]?>'><?php echo $row['type']?></option>
                <?php endwhile; ?>
            </select>
        </div>
        <div id='states_container' style="float:left"></div>
        <div style="clear: both"></div></br></br>
        <input type='submit' name='post' value='Check'>
    </form>
    
    <!-- SCRIPTS -->
    <script src='default.js'></script>
</body>

load_states.php

<?php require 'mysql.conf.php'; ini_set('display_errors', 1); if(isset($_GET['country'])) { //connect to database mysql_connect(DB_HOST, DB_UNAME, DB_PWD) or die('Database error!!'); mysql_select_db(DB_NAME); $c = $_GET['country']; $states = ''; $r = mysql_query("SELECT `s_id`, `state` FROM state WHERE c_id='$c'"); while($row = mysql_fetch_assoc($r)) { $states .= ''.$row['state'].''; } if($states == '') echo ''; else echo 'Select State'.$states.''; } ?>

Thanks in advance

Sponsor our Newsletter | Privacy Policy | Terms of Service