posting troubles

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

posting troubles

Post 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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: posting troubles

Post 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]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Re: posting troubles

Post by Obadiah »

well...i feel noobishly monstertard 'ish'...lol
Post Reply