Selecting from a drop down and displaying the results

HI,

I have table called clients and one of the fields within it is called clientStatus. What i am trying to create is a drop down menu where i can select a status (there are 5) and it will display all client with that status in a table displaying then clientName, startDate, expireyDate and totalContract

the code i have is below and thanks for the help.

?php
$dbconnection = mysql_connect(); etc
?>

option 1 <option 2 <option 3 <option 4 <option 5 <?php // Check if POST is set from form if(isset($_POST)) { $sql = "SELECT * FROM `clients` WHERE clientStatus = ‘$_POST[stateside]’); // Query needed for db $result = mysql_query($sql, $dbconnection); // mysql query while ($row = mysql_fetch_assoc($result)) { echo $row[‘clientName']; // loop through each row and output info } } ?>

Give this a try…

[php]$sql = “SELECT * FROM clients WHERE clientStatus = '” . $_POST[‘clientStatus’] . “’”;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service