PDA

View Full Version : help in select menu


hussam81
07-01-2013, 03:06 PM
I maked like the image exactly as a form .But What programiing that is when selecting an item from the menu, then choose one of the radio buttons and then pressing the search button query who shall work and show the result

Are there examples relative to this picture
Note that the use of the language of php and dreamweaver program

Image http://store2.up-00.com/Apr13/OV586827.png

Thank you

edbr
07-02-2013, 02:24 AM
<?PHP

$selected_radio = $_POST['gender'];
print $selected_radio;

?> edit for yur POST variable name

hussam81
07-02-2013, 06:59 AM
thnks

this my code what is the rong here:
<?php
// start connect to db //*
$link=mysql_connect("localhost","root","1234");
mysql_query("set character_set_server='utf8'");
mysql_query("set names 'utf8'");
mysql_select_db('clinics',$link);

//------------------------------------------//


//bulid query

$array=mysql_query("SELECT * FROM clinic ORDER BY id DESC");

//-------------------------------
//declare variables
<?

$gender=$_POST['gndr'];
$post_select=$_POST['selectmenu'];

?>
//--------------------------------------------------------------
<div id="select"><p style="margin-top:5px; margin-left:5px; color:#287F9C;white-space:pre-wrap">Please provide any of the following information to search for a doctor / physician.</p>


<form action="" method="post" >
<select name="selectmenu">
<option>---Select a department</option>
<?
while ($row=mysql_fetch_array($array)){?>

<option value="<?php echo $row['id'];?>" <? echo ($id == $row['id']) ? "selected" : "";?>>

<?php
echo $row['clinic_name'];
?>

</option>

<?

}

?>

</select>
<div id="radio">
<table>
<tr>
<td>
<input type="radio" name="gndr" value="male" id="male" /><label for="male">Male</label>
<input type="radio" name="gndr" value="female" id="female" /><label for="female">Female</label>
<input type="radio" name="gndr" value="nopref" id="nopref" checked="checked" /><label for="nopref">No Preference</label>
</td>
</tr>

</table>
</div>
search button:
<div id="search">
<input type="image" src="img/searchnow_btn.jpg" name="sub" />
<input type="hidden" name="sub" />
</div>
</form>


</div>
<div id="searchByName">
<div id="par"><span style="color:#287F9C; margin-top:5px">Please type the name of the doctor.</span></div>
<form action="./Find a Doctor Al Zahra Private Medical Centre, Dubai - UAE._files/Find a Doctor Al Zahra Private Medical Centre, Dubai - UAE..htm" method="get">
<table width="100%" cellspacing="0">
<tbody><tr>
<td>
<div id="textbox"> <input name="tag" size="45%" type="text" id="tag" />
</div>
<input type="hidden" id="dctr" name="dctrId" />
</td>
</tr>
<tr>
<td><div class="suggestionsBox" id="suggestions" style="display:none">
<!-- <img src="upArrow.png" style="position: relative; top: -12px; left: 30px" alt="upArrow" /> -->
<div class="suggestionList" id="autoSuggestionsList"></div></div>
</td>
</tr>
<tr>
<td align="right">
<!-- <a href=""><img src="../images/go_btn.gif" border="0" alt="go" /></a> -->
<input type="hidden" name="submit" value="go" />
<div id="go"> <input type="image" src="img/go_btn.gif" border="0" name="go" /></div>
</td>
</tr>

</tbody></table>
</form>
</div>
<div id="parg">You can easily find your doctor at Al Zahra by department or name using the search tools here.</div>
<div id="resultrow">
<?
$query=mysql_query("SELECT * FROM doctors WHERE gender='".$gender."' AND id_clinic='".$_GET['id']."'");
$num=mysql_num_rows($query);

if($num!==0){
echo "Results: $num Doctors Found";


}

else {
echo "Results: 0 Doctor Found";


}
?>



</div>

<?
if(isset($_POST['sub']) ){
while ($row=mysql_fetch_array($query)){?>

<div id="drdetail">
<div id="docimg" style=" margin-left:7px; margin-top:7px; float:left">
<img src="img/14.jpg" width="62" height="54" />
<br/>
<img src="img/prfl_btn.gif" style="margin-top:10px; margin-left:5px;" border="" alt""="">
</div>
<div id="detail" style="margin-left:7px; line-height:25px; color:#287F9C; margin-top:7px; width:auto; float:left">
<td style="font-family:Georgia, Times New Roman, Times, serif"><?php echo $row['doctor_name'];?></td><br/><div id="detl" style="color:#000"><b style="color:#287F9C;">Department</b> : <?php echo $row['clinic_name'];?><br/><b style="color:#287F9C;">Designation</b> :<?php echo $row['designation'];?><br/><b style="color:#287F9C;">Education</b>&nbsp; &nbsp; : <?php echo $row['education'];?><br/><b style="color:#287F9C">Available for consultations at</b><br/><table >
<tbody class="tables">
<tr>
<td style="border:solid 1px #FFF;">Al Zahra Pvt. Hospital, Sharjah</td>
<td style="color:#BE1C27; border:solid 1px #FFF;" ><img src="../Find a Doctor Al Zahra Private Medical Centre, Dubai - UAE._files/tickmark.gif" /></td>
</tr>
<tr>
<td style="border:solid 1px #FFF;">Al Zahra Medical Centre, Dubai</td>
<td style="color:#BE1C27;border:solid 1px #FFF;"><img src="../Find a Doctor Al Zahra Private Medical Centre, Dubai - UAE._files/tickmark.gif" /></td>
</tr>



</tbody></table></div></div></div>


<?

}
}


?>

edbr
07-02-2013, 07:22 AM
so the radios are here
<input type="radio" name="gndr" value="male" id="male" /><label for="male">Male</label>
<input type="radio" name="gndr" value="female" id="female" /><label for="female">Female</label>
<input type="radio" name="gndr" value="nopref" id="nopref" checked="checked" /><label for="nopref">No Preference</label>


first to test echo your POST variables
echo them to test.
then echo into your next form. to difficult to work through without a database and easier for you.

You should clean the code up a bit though

you have some orphan <?tags doe some reason which will throw errors. plus use <?php leave <? for XML tags