I want to make a mini calculator using following code
<html>
<head>
<title>Mini Cal</title>
</head>
<body>
<form action="mini_cal.php" method="post">
<table>
<tr>
<td>First Number : </td>
<td>
<input type="text" name="first_number" value="<?php echo $_POST['first_number'];?>">
</td>
</tr>
<tr>
<td>Last Name : </td>
<td>
<input type="text" name="second_number" value="<?php echo $_POST['second_number'];?>">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="btn" value="+">
<input type="submit" name="btn" value="-">
<input type="submit" name="btn" value="*">
<input type="submit" name="btn" value="/">
<input type="submit" name="btn" value="%">
</td>
</tr>
<tr>
<td>Result Name : </td>
<td>
<?php
/*echo '<pre>';
print_r($_POST);
exit();*/
if($_POST['btn']=='+')
{
echo $_POST['first_number'] + $_POST['second_number'];
}
if($_POST['btn']=='-')
{
echo $_POST['first_number'] - $_POST['second_number'];
}
if($_POST['btn']=='*')
{
echo $_POST['first_number'] * $_POST['second_number'];
}
if($_POST['btn']=='/')
{
if($_POST['second_number']==0)
{
echo 'Undefine';
}
else{
echo $_POST['first_number'] / $_POST['second_number'];
}
}
if($_POST['btn']=='%')
{
if($_POST['second_number']==0)
{
echo 'Undefine';
}
else{
echo $_POST['first_number'] % $_POST['second_number'];
}
}
?>
</td>
</tr>
</table>
</form>
</body>
</html>
I have got an warning message from netbeans IDE 8.0 -"do not access superglobal $_post array directly".
What can I do to fix this?