PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

Why is my PHP not validating with XAMPP installed?

Asked 2010-03-11 19:25:37 by adamskiii

I use PHP at school to work on assignments and need to install it at home. I installed XAMPP and put my files into default htdocs folder. The PHP files work, but I am writing .html files which will connect to PHP to validate the data. This is my code which at school worked fine:

PHP FILE:
<?php

$number1 = $_POST["number1"];
$numner2 = $_POST["number2"];
$average = ($number1 + $number2)/2;

if($average>89(
{
print ("Average score: $average You got an A!<br>";
}

$max = $number1;

if($number1 < $number2)
{
$max = $number2;
}

print ("Your max score was $max");

?>


HTML FILE:
<html>
<head>

<script language="javascript">

function checkNumber()
{
if(document.form1.number1.value == "")
{
alert ("Please enter a number 1");
}
else if (document.form1.number2.value == 0)
{
alert("Please enter a second number");
}

}
</script>

<title>Excersise 10</title>
</head>

<body>
<form name="form1" method="post" action="" onSubmit="return checkNumber()" action="excercise10.php">
<p>
<label>
Enter a number:
<input type="text" name="number1" id="number1">
</label>
</p>
<p>Enter a second number:
<label>
<input type="text" name="number2" id="number2">
</label>
</p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit">
</label>
</p>
</form>
</body>
</html>

Nothing happens at my house when I click submit. Why is this?

Thanks

Anwered 2010-03-11 19:29:13 by Mike

looks like have a typo

$numner2 should be $number2

Questions and answers provided by the Yahoo Answers Community.