How To get selected default value in drop down in php



How To get selected default value in drop down when I try to EDIT in php?

I have to pages,first one for view all data it called view.php

second called edit.php

in view.php URL named(EDIT) when I press edit in view.php will go to edit page to update value

her in edit page filed drop dwon list

I want when I need to update record via edit choose default value in view.php then i can update value in this drop down list

so please help me out,

I spent tow week to resolve this problem, so please help me!

I will upload tow files to check out, view.php, edit.php.



Kindly any update…

Hi temo,

Are you trying to accomplish what you need using Yii?

As your files looks quite strange for Yii and MVC at all…

If you use Yii, I’d suggest first to start from common documentation and then move to particular questions.

If not - please select other forum thread for your question.



Hi Yuga,

Thanks for your reply.

I correct same codes in my edit.php file.

the problem is I want to select default value in drop down list when i try to edit

I will upload edit.php file after update…

I issue this command

echo "$Btypes"; — it,s ok i can echo the defaule selected value. in the below code I want to call the default value and after select default value, i can able to find the reaming values in drop down list.

any way i will upload the EDIT.PHP.



<? $query = mysql_query ("SELECT * FROM TYPES");

while ($row = mysql_fetch_assoc($query ))


$Btype = $row[‘TypeName’];


<option value="<?php echo $row [‘typeid’]; ?>"><?php echo $row [‘TypeName’]; ?></option>