get all values in where clause

NartcertThuth

New Member
Am facing troubles in this code, i just want to get all data from table row if the user selected "show all" from the select drop menu.here is the select menu !so, this menu grab data from this table, but if he selects All, what is the suitable code to echoing in between option value :)\[code\]<b>speciality:</b> <select id="main_mav" name="speciality"><option value="http://stackoverflow.com/questions/10559606/none">Select speciality:</option><option value=""> All specialities </option><?php $result = mysql_query('SELECT speciality FROM visits') or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row['speciality'].'">'.$row['speciality'].'</option>'; }?></select><br />\[/code\]That's the Submit form !\[code\]if ($region=="All regions" ){ $region=$_POST['""']; } else ( $region=$_POST['region']); $date1 =$_POST['from_date']; $date2 = $_POST['to_date']; $product=$_POST['product']; $speciality=$_POST['speciality']; $type=$_POST['visit_type'];sql="SELECT id, customer_name, seller_1_name, seller_2_name FROM visits Where (speciality ='$speciality') AND (visit_type ='$type') AND (product ='$product') AND (region ='$region') AND (visit_date BETWEEN '$date1' AND '$date2')";$result=mysql_query($sql); ## This line is new.$num=mysql_numrows($result);$row = mysql_fetch_array($result);\[/code\]What's the correct code to enter if user selected " show all in drop menu " ?!
 
Back
Top