could you take a look at my code and tell me what I did worng
in poll.htm file:
Code:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Poll</title>
<FONT face=Courier color=#ffcc00 size=2></FONT>
<script language="Javascript">
<!--
function ValidateForm(form) {
if (!form.Answer[0].checked && !form.Answer[1].checked) {
alert("Please choose your answer before submitting!");
form.Answer[0].focus();
return false;
}
}
//-->
</script>
</head>
<body bgcolor="#008000">
<pre><font face="Courier" color="#999999" size="2"></pre>
<p></p>
<center>
<table cellpadding="15" cellspacing="0" border="1">
<tr>
<td bgcolor="#006666"><font face="Arial" size="2" color="#ffffff">Isn't my first PHP poll just excellent? </font></td>
</tr>
<tr>
<td><font face="Arial" size="2" color="#ffffff"><font color="#ffcc00">
<form name="Poll" onSubmit="return ValidateForm(this)" method="post" action="results.php">
<input type="radio" name="Answer" value="1">Yes<br>
<input type="radio" name="Answer" value="2">No<br>
<br>
<input type="submit" value="Submit"> <input type="reset">
</form>
</font><a href="results.php"><font face="Arial" size="2" color="#ffffff">see
the results </font> </a></font></td>
</tr>
</table>
</center>
<p></p>
<pre></pre>
</font>
</body>
</html>
in results.php
PHP Code:
<html>
<title>Poll results</title>
<body>
<center>
<table cellpadding=15 cellspacing=0 border=1>
<tr>
<td bgcolor="#006666">
<font face="Arial" size=2 color="#ffffff">
Isn't my first PHP poll just excellent?
</font>
</td>
</tr>
<tr>
<td>
<font face="Courier" size=2 color="#ffffff">
<body bgcolor="#008000">
<?php
mysql_connect("localhost", "root");
$query = "SELECT votes from polldb WHERE answer_id = 1;";
$result = (mysql_db_query("database", $query));
$row = mysql_fetch_array($result);
$votes = $row["votes"];
echo"Yes: $votes vote(s)<br>";
$query = "SELECT votes from polldb WHERE answer_id = 2;";
$result = (mysql_db_query("database", $query));
$row = mysql_fetch_array($result);
$votes = $row["votes"];
echo"No: $votes vote(s)<br>";
if (isset($Answer)) {
$query = "UPDATE polldb SET votes=votes+1
WHERE answer_id = $Answer;";
$result = mysql_db_query("database", $query);
}
?>
</td>
</tr>
</table>
</center>
</body>
</html>
When I run this code I'm getting 405 error: method not allowed for url /
Any idea why it happens?
Thanks
Q