Drawing HTML table via PHP with data per Cell

I have a bad time trying to code this one. I'm trying to put data inside the cell with a certain value. Btw, my code is for solving IP addressing tableBtw, StackOverflow wont allow me to post image because I'm a new user this is the printscreen of my codeImagein "LUSH" the selected ip must be 121.145.23.62 not 121.145.23.0, the formula by getting this is .64-2 to get .62 same as .128 - 2 = .126 ...... respectively as same as on "BA" the ip's on "LUSH" must be added by 1 just like this : .62+.1 = . 63 ; .126+1 = .127 .... respectivelyThis is my code:\[code\]<html><body><?php $oct_one = $_POST["octet1"];$oct_two = $_POST["octet2"];$oct_three = $_POST["octet3"];$rows = $_POST["numnet"] + 1;$theader = array("SNA","FUSH","LUSH","BA","SMA","SLASH");$un_min_theader_count = count($theader);$min_theader_count = $un_min_theader_count - 1;$init_valtest = 1;$stepping = 0;$limit = 0;$slash = 0;while(2*$init_valtest <= $rows-2) { $init_valtest++; }switch ($init_valtest){case 1: $stepping = 128; $limit = 128; $slash = 25; break;case 2: $stepping = 64; $limit = 192; $slash = 26; break;case 3: $stepping = 32; $limit = 224; $slash = 27; break;case 4: $stepping = 16; $limit = 240; $slash = 28; break;case 5: $stepping = 8; $limit = 258; $slash = 29; break;case 6: $stepping = 4; $limit = 266; $slash = 30; break;case 7: $stepping = 2; $limit = 270; $slash = 31; break; case 8: $stepping = 1; $limit = 271; $slash = 32; break; default: $stepping = 1;}echo "<table border='1'>"; for($th=0;$th<=$min_theader_count;$th++){ echo "<th>" , $theader[$th] , "</th>"; }for($tr=0;$tr<=$limit;$tr+=$stepping){ if($tr == 256){ $tr = 255; } if($limit == 258){ $limit = 255; } echo "<tr>"; echo "<td>" , $oct_one , "." , $oct_two , "." , $oct_three , "." , $tr , "</td>"; echo "<td>" , $oct_one , "." , $oct_two , "." , $oct_three , "." , $tr+1 , "</td>"; echo "<td>" , $oct_one , "." , $oct_two , "." , $oct_three , "." , $tr-2, "</td>"; echo "<td>" , $oct_one , "." , $oct_two , "." , $oct_three , "." , $tr, "</td>"; echo "<td>" , "255" , "." , "255" , "." , "255" , "." , $limit , "</td>"; echo "<td>" , $slash , "</td>"; echo "</tr>"; }echo "</table>"; ?></body></html>\[/code\]How to resolve this?Sorry for wrong grammar(S).
 
Back
Top