PDA

View Full Version : PhP Homework Due In 2 Days! Please Help!



stupid21
11 Feb 2010, 01:50 PM
Ok i have to make a Class C subnet calculator for my PhP homework.

I have the html page made ( http://roecomputer.com/Stevie3/sub3.html )

I just need a code that will print the first 3 Octets that the person types in and it will calculate how many bits they selected / The number of hosts / and the Maximum Subnets


But the page that it is getting from i dont have any code for it yet.

Can someone please help me....

I tryed to use this code that i typed but its not working.



<html>
<head>
<title>Answer</title>
</head>
<body>

<BODY bgcolor="#0099CC">



<?php
$bitsOne = filter_input(INPUT_GET,"bitsOne");
print "<h3>You Selected, $bitsOne , bits!</h3>";



$bits = (1,6)





if ( $bits == 1) {
print "You Chose 1 Bits";
"There are 126 Hosts Per Subnet";
"There are 2 Maximum Subnets";
}

if ( $bits == 2) {
print "You Chose 2 Bits";
"There are 62 Hosts Per Subnet";
"There are 4 Maximum Subnets" ;
}

if ( $bits == 3) {
print "You Chose 3 Bits";
"There are 30 Hosts Per Subnet";
"There are 8 Maximum Subnets"
}


if ( $bits == 4) {
print "You Chose 4 Bits";
"There are 14 Hosts Per Subnet";
"There are 16 Maximum Subnets";
}


if ( $bits == 5) {
print "You Chose 5 Bits";
"There are 6 Hosts Per Subnet";
"There are 32 Maximum Subnets" ;
}


if ( $bits == 6) {
print "You Chose 6 Bits";
"There are 2 Hosts Per Subnet";
"There are 64 Maximum Subnets" ;
}



?>

</body>
</html>


I just need a code like that ^ so it will print the first 3 Octets that the person types in and it will calculate how many bits they selected / The number of hosts / and the Maximum Subnets


Please help me!