Sorry for the confusion.
Here's the whole section of code :-
<p>Browse through some of the equipment for sale:
<?
include("config/config_sql.php");
// create connection
$dbcnx = mysql_connect("$server","$user","$password")
or die("Couldn't make connection.");
// select database
$db = mysql_select_db("$database", $dbcnx)
or die("Couldn't select database.");
// create SQL statement
$sql = "SELECT * FROM types
ORDER BY type ASC";
// execute SQL query and get result
$sql_result = mysql_query($sql,$dbcnx)
or die("Couldn't execute query.");
// put data into drop-down list box
while ($row = mysql_fetch_array($sql_result)) {
$type = $row["type"];
$typedesc =$row["typedesc"];
$option_block .= "<OPTION value=\"$type\">$typedesc</OPTION>";
}
$type = $_POST['selecttype'];
?>
<FORM method="POST" name="selectform" action="listequipment.php?forsaleorwanted=s&type=<?echo $type;?>">
<P>Select a category :<br>
<SELECT name="selecttype">
<? echo "$option_block"; ?>
</SELECT>
<P><INPUT name="forsale" type="submit" id="forsale" value="List"></p>
</FORM>
I want to pass the value of the SELECT 'selectype' to a new page as a variable called $type. I thought i did this by using $type = $_POST['selecttype']; but when i check the url being passed to the new page, type is emtpy.
Also tried changing the line :
<FORM method="POST" name="selectform" action="listequipment.php?forsaleorwanted=s&type=<?echo $type;?>">
to :
<FORM method="POST" name="selectform" action="listequipment.php?forsaleorwanted=s&type=<?echo $selecttype;?>">
But type is still empty. i have checked $option_block and that is getting populated with all the correct values.