hi all,
I have a problem getting value from select option
my code is below

<form name="secmek" action="add.php" method="post">
      
  <select name="list" id="list">
  
  <?
  @$db=mysql_connect('localhost','uname','pass');
mysql_select_db('dbname');
  $sorgucat=mysql_query("select * from category");
while($satircat=mysql_fetch_row($sorgucat))
{
echo "<option value='$satircat[0]'>$satircat[1]</option>";
}
	

?>
</select>
<input type="submit" value="poz" name="del">

  </form>

and this is my category table sql

CREATE TABLE `category` (
  `id` int(11) NOT NULL auto_increment,
  `cat` varchar(30) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

i need to receive content from drop down menu (in select options) and delete it.
but i cannot receive from select options
thanks beforehands

does it only populate one thing into the select and you want to have more or it doesnt work at all ?

Yeah as you said. it populates data into select options and amount of select options dependent on how many items it received from database.
Thanks for attention

$list = $_POST['list'];

i think this is what you are trying to do you would need to add this to post the data to a variable so that php can then use it once you hit the subbit button

thanks
but can you show it on my code

<?PHP
$list = $_POST['list'];
// i changed your post to post to current page not sure if that is what you are trying to do but if it isnt just put the list on top of the page you are going to post this too
 	echo "<form name='input' action='".$_SERVER['php_self']."' method='POST'>";
// echo "<form name='secmek' action='add.php' method='post'>
	echo "<select name='list' id='list'>";
  @$db=mysql_connect('localhost','uname','pass');
	mysql_select_db('dbname');
  		$sorgucat=mysql_query("select * from category");
while($satircat=mysql_fetch_row($sorgucat))
{
echo "<option value='$satircat[0]'>$satircat[1]</option>";
}
echo "</select><input type='submit' value='poz' name='del'></form>";
?>

Thank you very much

not a problem enjoy

sir,
i have 2 fields.
2 drop down list . the value in both the drop down list is coming from database.
but i want that in the first drop down list if i click on a value than the second drop down list shows only those values that are for it.
suppose i have 2 fields.first name & last name in the first dropdown list
so if i click on first name than in the second drop down list first name should come & so on

make the first select submit onchange then you query line will use that value to only grab the feilds that have that value and your done this would be the easiest way with out using javascript

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.