0

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

3
Contributors
9
Replies
10
Views
7 Years
Discussion Span
Last Post by HITMANOF44th
0

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

0
$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

0
<?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>";
?>
0

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

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.