Reply to Passing values from drop down menu

Your name:

Reply:


Posted by barbarowa on 02/05/06 23:50

I've coded a script to populate a drop down menu from a database but I
can't seem to get the PHP script to pass the selected item. The
database only has two fields, ID and ITEM. I want the user to be able
to see all the choices and pick one. This choice would then be used
to update another database.

The drop down menu populates correctly. When I test for the variable
being passed, nothing is showing up. Here is the code:

<?php

include("connect.php");

if($_POST['testform']) {

print_r($HTTP_POST_VARS);
exit;
}

?>
<form name="testform" action="<?php echo $PHP_SELF; ?>" method="post">

<?php

$query = "SELECT * FROM mytable ORDER BY item";
$result = mysql_query($query) or die ("$text[cannotexecutequery]:
$query");

echo "<select name='id'>";
while($row=mysql_fetch_assoc($result))
{
echo "<option value=" . $row['id'].">".$row['item']."</option>";
}
echo "</select>";
echo "<input type='submit' value='Submit' name='testform'>
<input type='reset' value='Reset' name='reset'>
</form>";

?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация