Page 1 of 1

posting troubles

Posted: Wed Oct 13, 2010 3:14 pm
by Obadiah

Code: Select all

Can anyone help me figure out why the $percent variable isn't posting

<?php

$postIt = $_SERVER["PHP_SELF"]; 
$display_block .="
<b>Choose a department to review:</b>&nbsp;
<form action=\"$postIt\" >
<select name=\"area\" onchange=\"this.form.submit();\">
<option>Behm</option>
<option>BronchLab</option>
<option>C/SParkPlace</option>
</select>
</form>
";

$areaSelected = $_POST['area'];
$conn = doDB();
$sql = "Select percent1 FROM data WHERE Area = '{$areaSelected}'";
$result = mysql_query($sql,$conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result))
{
 $percent = $newArray['percent1'];
}

$display_block .="
the percent is $percent
";
echo $areaSelected;//nothing happens here?!?
<html>
<head>
<meta http-equiv="pragma" content="no-cache"/>
<title>KDMC - Quality Manager Admin Online</title>
<link href="ostyle.css" rel="stylesheet" type="text/css">

</head>
<body>
<?php echo $display_block; ?>
</body>
</html>
?>
now when I select a area it does post to the as i can see it in the url[text]http://site/admin/member.php?area=Behm[/text]
but it doesnot allow me to even echo it...what the heck?

Re: posting troubles

Posted: Wed Oct 13, 2010 3:22 pm
by AbraCadaver
As you can see in the URL it isn't POSTING, it is GETting which is the default for the form when not specified. So either use $_GET or change the form method:

[text]<form action=\"$postIt\" method=\"post\">[/text]

Re: posting troubles

Posted: Wed Oct 13, 2010 4:49 pm
by Obadiah
well...i feel noobishly monstertard 'ish'...lol