Php/Bankers Algorithm
Posted: Sat Sep 24, 2011 3:56 am
can any one help me out about my problem in my php i cant put the Max Tab in the right side of the Allocated tab is there anyone who can help me here please
<html>
<head></head>
<body>
<form method="post" action="OS.php">
Enter number of rows <input name="rows" type="text" size="4">
and columns <input name="columns" type="text" size="4">
<input type="submit" name="submit" value="Draw Table">
</form>
<?php
echo"<table border = 5%>";
$columns = $_POST['columns'];
for($i=1; $i<= $columns; $i++)
{
echo "Instance $i = "."<input type='text' size='2' name='r[]'>"." ";
}
echo"<br>Alocation Max Need Work";
if (isset($_POST['submit'])) {
// set variables from form input
$rows = $_POST['rows'];
$columns = $_POST['columns'];
// loop to create rows
for ($r = 1; $r <= $rows; $r++) {
// loop to create columns in Allocated
for ($c = 1; $c <= $columns;$c++) {
echo "<td><input type='text' name='input[".$r."][".$c."]' size='5' > </td>";
} echo "";
}
}
for ($r = 1; $r <= $rows; $r++) {
// loop to create columns in Max
for ($c = 1; $c <= $columns;$c++) {
echo "<td><input type='text' name='max[".$r."][".$c."]' size='5'></td> ";
} echo "";
}
echo"</table>";
?>
<br>
<br><input type="submit" name="submit" value="Submit">
<input type="reset" name="Reset">
</body>
</html>
<html>
<head></head>
<body>
<form method="post" action="OS.php">
Enter number of rows <input name="rows" type="text" size="4">
and columns <input name="columns" type="text" size="4">
<input type="submit" name="submit" value="Draw Table">
</form>
<?php
echo"<table border = 5%>";
$columns = $_POST['columns'];
for($i=1; $i<= $columns; $i++)
{
echo "Instance $i = "."<input type='text' size='2' name='r[]'>"." ";
}
echo"<br>Alocation Max Need Work";
if (isset($_POST['submit'])) {
// set variables from form input
$rows = $_POST['rows'];
$columns = $_POST['columns'];
// loop to create rows
for ($r = 1; $r <= $rows; $r++) {
// loop to create columns in Allocated
for ($c = 1; $c <= $columns;$c++) {
echo "<td><input type='text' name='input[".$r."][".$c."]' size='5' > </td>";
} echo "";
}
}
for ($r = 1; $r <= $rows; $r++) {
// loop to create columns in Max
for ($c = 1; $c <= $columns;$c++) {
echo "<td><input type='text' name='max[".$r."][".$c."]' size='5'></td> ";
} echo "";
}
echo"</table>";
?>
<br>
<br><input type="submit" name="submit" value="Submit">
<input type="reset" name="Reset">
</body>
</html>