Error: POST Method Not Allowed
Posted: Thu Jan 09, 2003 1:10 pm
Hi..I am new to php. I wrote a simple program with forms in it. I am encountering this error message whenever i try to run any php program with forms....Method Not Allowed
The requested method POST is not allowed for the URL /calculate.php.
Could anybody please help me with this?
This is my calculate_fom.html which calls calculate.php
This is calculate.php
The requested method POST is not allowed for the URL /calculate.php.
Could anybody please help me with this?
This is my calculate_fom.html which calls calculate.php
Code: Select all
<html>
<head>
<title>Calculation Form</title>
</head>
<body>
<form method="post" action="calculate.php">
<p>Value 1 :
<input type="text" name="val1" size="10">
</p>
<p>Value 1 :
<input type="text" name="val2" size="10">
</p>
<p>Calculation:<br>
<input type="radio" name="calc" value="add">
add <br>
<input type="radio" name="calc" value="subtract">
subtract<br>
<input type="radio" name="calc" value="multiply">
multiply<br>
<input type="radio" name="calc" value="divide">
divide<br></p>
<p>
<input name="submit" type="submit" VALUE="Calculate">
</p>
</form>
</body>
</html>Code: Select all
<?php
if (($_POSTї'val1']=="")||($_POSTї'val2']=="")||($_POSTї'calc']=="")){
header("Location:http://localhost/calculate_form.html");
exit;
}
if ($_POSTї'calc']=="add"){
$result = $_POSTї'val1'] + $_POSTї'val2'];
}
else if ($_POSTї'calc']=="subtract"){
$result = $_POSTї'val1'] - $_POSTї'val2'];
}
else if ($_POSTї'calc']=="multiply"){
$result = $_POSTї'val1'] * $_POSTї'val2'];
}
else if ($_POSTї'calc']=="divide"){
$result = $_POSTї'val1'] / $_POSTї'val2'];
}
?>
<html>
<head>
<title>Calculation result</title>
</head>
<body>
<p>The result of the calculation is : <?php echo "$result"; ?></p>
</body>
</html>