Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
little help with PHP program
well I'm trying to make a kind of memory converter (B=>MG=>GB=>TB….)
either Im doing my math wrong or php doesnt like big numbers, can someone tell me if im on the right track or if im doing something wrong?
this is what i have so far i quit when i started getting weird numbers
<h1>Megabyte converter</h1>
<form action=test.php method=post>
Bytes: <input type=text name=b></br>
Kilobytes: <input type=text name=k></br>
Megabytes: <input type=text name=m></br>
Gigabytes: <input type=text name=g></br>
Terabytes: <input type=text name=t></br>
Petabytes: <input type=text name=p></br>
Exabytes: <input type=text name=e></br>
Zettabytes: <input type=text name=z></br>
Yottabytes: <input type=text name=y></br>
<input type=submit value=calculate></br>
</form>
<?php
$b = (int)($_POST ["b"]);
$k = (int)($_POST ["k"]);
$m = (int)($_POST ["m"]);
$g = (int)($_POST ["g"]);
$t = (int)($_POST ["t"]);
$p = (int)($_POST ["p"]);
$e = (int)($_POST ["e"]);
$z = (int)($_POST ["z"]);
$y = (int)($_POST ["y"]);
echo ("Bytes: " . $b . '</br>' );
echo ("Kilobytes: " . $b /1024 . '</br>' );
echo ("Megabytes: " . $b /1048576 . '</br>' );
echo ("Gigabytes: " . $b /1073741824 . '</br>' );
echo ("Terabytes: " . $b /1099511627776 . '</br>' );
echo "Petabytes: "
echo "Exabytes: "
echo "Zettabytes: "
echo "Yottabytes: "
?>
ps im new to php so dont flame me