Campusconnects's Posts
Nairaland Forum › Campusconnects's Profile › Campusconnects's Posts
1 (of 1 pages)
Below is a CGPA Calculator: version - 1.03, programmer - Adepoju Aliu(O.O.U student), Aim & objective - for the purpose of challenges from other programmers <?php ?> <form action='<?php echo $_SERVER[PHP_SELF]?>' method='post'> <table border='0px' style='width:250px;margin-left:auto;margin-right:auto;float:left'> <tr><td style='width:50px'><select name='rowNumber' style='border:1px solid #666;width:50px'> <?php for ($i=1;$i<=50;$i++) { $selected = ((isset($_POST['rowNumber']) && $_POST['rowNumber'] == $i) || (isset($_GET['rowNumber']) && $_GET['rowNumber'] == $i))?"selected":""; print("<option value='".$i."'$selected>".$i."</option>" ;} ?> </select></td> <td><input type='submit' name='SpecifyRows' style='width:85px;cursor:pointer' value='Specify rows'/> <input type='submit' style='width:65px;cursor:pointer' name='reset' value='Reset'/></td></tr> </table> </form> <?php class gpClassic { public $_num; public $_gp; function __construct($num) { $this->_num = $num; } function rowNum() { echo <<< FORM <form action='{$_SERVER[PHP_SELF]}?applications=yes&rowNumber={$_GET[rowNumber]}' method='post'> <table border='0px' style='width:240px;margin-left:auto;margin-right:auto;float:left;clear:both'> <tr style='background-color:#666;color:#fff;font-size:12px;text-align:center'><th style='width:20px'>S/N</th><th style='width:50px'>Unit</th><th style='width:75px'>Course Code</th><th style='width:60px'>Grade</th></tr> FORM; for ($us=1,$gs=1;$us<=$this->_num,$gs<=$this->_num;$us++,$gs++) { echo <<< FORM <tr style='background-color:#ccc'> <td style='text-align:center'>{$us}.</td> <td style='width:50px'><select name='unit{$us}' style='border:1px solid #666;width:100%'> <option value=''>Unit</option> FORM; for ($uo=1;$uo<=5;$uo++) { $selected = (isset($_POST[unit.$us]) && $_POST[unit.$us] == $uo)?"selected":""; print("<option value='{$uo}' $selected>{$uo}</option>" ;} echo <<< FORM </select></td> <td style='text-align:center;width:75px'><input style='width:75px;border:1px solid #666' type='text' name='courseCode{$us}' value={$_POST[courseCode.$us]} ></td> <td style='width:60px'><select name='grade{$gs}' style='border:1px solid #666;width:60px'> <option value=''>Grade</option> FORM; for ($go=5;$go>=0;$go--) { $selected = (isset($_POST[grade.$gs]) && $_POST[grade.$gs] == $go && $_POST[grade.$gs] != "" ?"selected":"";print("<option value='".$go."'$selected>" ;if ($go == 5) print("A$go" ;elseif ($go == 4) print("B$go" ;elseif ($go == 3) print("C$go" ;elseif ($go == 2) print(" $go" ;elseif ($go == 1) print("E$go" ;elseif ($go == 0) print("F$go" ;print("</option>" ;} print("</select></td>" ;print("</tr>" ;} $calc = gpClassic::calc(); echo <<< FORM <tr><td colspan=4 style='text-align:left'><span style='font-weight:bold'>CGPA: </span>{$calc}</td></tr> <tr><td colspan=2 style='text-align:left'><input type='submit' name='calculate' style='cursor:pointer' value='Calculate'/></td><td colspan=2 style='text-align:right'><input type='submit' name='add' style='width:55px;cursor:pointer' value='Add'/> <input type='submit' name='rev' style='width:60px;cursor:pointer' value='Remove'/> </td></tr> </table> </form> FORM; } function handleError() { if (isset($_POST['calculate'])) { for ($hg=1;$hg<=$this->_num;$hg++) { if (!isset($_POST[unit.$hg]) || $_POST[unit.$hg] == "" || !isset($_POST[courseCode.$hg]) || $_POST[courseCode.$hg] == "" || !isset($_POST[grade.$hg]) || $_POST[grade.$hg] == "" ![]() { return("<span style='color:red;font-family:arial;font-size:12px'>Error has occurred.</span>" ;} if (!preg_match("/^[a-zA-Z]{3}[0-9]{3}$/", $_POST[courseCode.$hg])) { return("<span style='color:red;font-family:arial;font-size:12px'>Invalid course code.</span>" ;} } } } function calc() { if (isset($_POST['calculate']) && !gpClassic::handleError()) { for ($tp=0;$tp<=$this->_num;$tp++) { $totalPoint[] = $_POST[unit.$tp] * $_POST[grade.$tp]; $totalUnit[] = $_POST[unit.$tp]; } bcscale(2); if (array_sum($totalUnit) != 0) { $this->_gp = bcdiv(array_sum($totalPoint), array_sum($totalUnit)); $_SESSION['gp'] = $this->_gp; return($this->_gp); } else { return("0.00" ;} } else { return(gpClassic::handleError()); } } function reward() { $gp = $_SESSION['gp']; if ($gp == 4.50 || $gp > 4.50) { return("FIRST CLASS" ;} elseif (($gp == 3.50 || $gp > 3.50) && $gp < 4.50) { return("SECOND CLASS UPPER" ;} elseif (($gp == 2.40 || $gp > 2.40) && $gp < 3.50) { return("SECOND CLASS LOWER" ;} elseif (($gp == 1.50 || $gp > 1.50) && $gp < 2.40) { return("THIRD CLASS" ;} elseif (($gp == 1.00 || $gp > 1.00) && $gp < 1.50) { return("PASS" ;} } } if (isset($_POST['SpecifyRows'])) { $_GET['rowNumber'] = $_POST['rowNumber']; $instance = new gpClassic($_POST['rowNumber']); $instance->rowNum(); } else if (isset($_POST['calculate'])) { $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } elseif (isset($_POST['reset'])) { unset($_SESSION['gp']); $instance = new gpClassic($_POST['rowNumber']); $instance->rowNum(); } else { if (isset($_POST['rev']) && $_GET['rowNumber'] >= 2) { $_GET['rowNumber'] = $_GET['rowNumber'] - 1; $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } else { $_GET['rowNumber'] = $_GET['rowNumber'] + 1; $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } } ?> |
<?php ?> <form action='<?php echo $_SERVER[PHP_SELF]?>' method='post'> <table border='0px' style='width:250px;margin-left:auto;margin-right:auto;float:left'> <tr><td style='width:50px'><select name='rowNumber' style='border:1px solid #666666;width:50px'> <?php for ($i=1;$i<=50;$i++) { $selected = ((isset($_POST['rowNumber']) && $_POST['rowNumber'] == $i) || (isset($_GET['rowNumber']) && $_GET['rowNumber'] == $i))?"selected":""; print("<option value='".$i."'$selected>".$i."</option>" ;} ?> </select></td> <td><input type='submit' name='SpecifyRows' style='width:85px;cursor:pointer' value='Specify rows'/> <input type='submit' style='width:65px;cursor:pointer' name='reset' value='Reset'/></td></tr> </table> </form> <?php class gpClassic { public $_num; public $_gp; function __construct($num) { $this->_num = $num; } function rowNum() { echo <<< FORM <form action='{$_SERVER[PHP_SELF]}?applications=yes&rowNumber={$_GET[rowNumber]}' method='post'> <table border='0px' style='width:240px;margin-left:auto;margin-right:auto;float:left;clear:both'> <tr style='background-color:#666666;color:#ffffff;font-size:12px;text-align:center'><th style='width:20px'>S/N</th><th style='width:50px'>Unit</th><th style='width:75px'>Course Code</th><th style='width:60px'>Grade</th></tr> FORM; for ($us=1,$gs=1;$us<=$this->_num,$gs<=$this->_num;$us++,$gs++) { echo <<< FORM <tr style='background-color:#cccccc'> <td style='text-align:center'>{$us}.</td> <td style='width:50px'><select name='unit{$us}' style='border:1px solid #666666;width:100%'> <option value=''>Unit</option> FORM; for ($uo=1;$uo<=5;$uo++) { $selected = (isset($_POST[unit.$us]) && $_POST[unit.$us] == $uo)?"selected":""; print("<option value='{$uo}' $selected>{$uo}</option>" ;} echo <<< FORM </select></td> <td style='text-align:center;width:75px'><input style='width:75px;border:1px solid #666666' type='text' name='courseCode{$us}' value={$_POST[courseCode.$us]} ></td> <td style='width:60px'><select name='grade{$gs}' style='border:1px solid #666666;width:60px'> <option value=''>Grade</option> FORM; for ($go=5;$go>=0;$go--) { $selected = (isset($_POST[grade.$gs]) && $_POST[grade.$gs] == $go && $_POST[grade.$gs] != "" ?"selected":"";print("<option value='".$go."'$selected>" ;if ($go == 5) print("A$go" ;elseif ($go == 4) print("B$go" ;elseif ($go == 3) print("C$go" ;elseif ($go == 2) print(" $go" ;elseif ($go == 1) print("E$go" ;elseif ($go == 0) print("F$go" ;print("</option>" ;} print("</select></td>" ;print("</tr>" ;} $calc = gpClassic::calc(); echo <<< FORM <tr><td colspan=4 style='text-align:left'><span style='font-weight:bold'>CGPA: </span>{$calc}</td></tr> <tr><td colspan=2 style='text-align:left'><input type='submit' name='calculate' style='cursor:pointer' value='Calculate'/></td><td colspan=2 style='text-align:right'><input type='submit' name='add' style='width:55px;cursor:pointer' value='Add'/> <input type='submit' name='rev' style='width:60px;cursor:pointer' value='Remove'/> </td></tr> </table> </form> FORM; } function handleError() { if (isset($_POST['calculate'])) { for ($hg=1;$hg<=$this->_num;$hg++) { if (!isset($_POST[unit.$hg]) || $_POST[unit.$hg] == "" || !isset($_POST[courseCode.$hg]) || $_POST[courseCode.$hg] == "" || !isset($_POST[grade.$hg]) || $_POST[grade.$hg] == "" ![]() { return("<span style='color:red;font-family:arial;font-size:12px'>Error has occurred.</span>" ;} if (!preg_match("/^[a-zA-Z]{3}[0-9]{3}$/", $_POST[courseCode.$hg])) { return("<span style='color:red;font-family:arial;font-size:12px'>Invalid course code.</span>" ;} } } } function calc() { if (isset($_POST['calculate']) && !gpClassic::handleError()) { for ($tp=0;$tp<=$this->_num;$tp++) { $totalPoint[] = $_POST[unit.$tp] * $_POST[grade.$tp]; $totalUnit[] = $_POST[unit.$tp]; } bcscale(2); if (array_sum($totalUnit) != 0) { $this->_gp = bcdiv(array_sum($totalPoint), array_sum($totalUnit)); $_SESSION['gp'] = $this->_gp; return($this->_gp); } else { return("0.00" ;} } else { return(gpClassic::handleError()); } } function reward() { $gp = $_SESSION['gp']; if ($gp == 4.50 || $gp > 4.50) { return("FIRST CLASS" ;} elseif (($gp == 3.50 || $gp > 3.50) && $gp < 4.50) { return("SECOND CLASS UPPER" ;} elseif (($gp == 2.40 || $gp > 2.40) && $gp < 3.50) { return("SECOND CLASS LOWER" ;} elseif (($gp == 1.50 || $gp > 1.50) && $gp < 2.40) { return("THIRD CLASS" ;} elseif (($gp == 1.00 || $gp > 1.00) && $gp < 1.50) { return("PASS" ;} } } if (isset($_POST['SpecifyRows'])) { $_GET['rowNumber'] = $_POST['rowNumber']; $instance = new gpClassic($_POST['rowNumber']); $instance->rowNum(); } else if (isset($_POST['calculate'])) { $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } elseif (isset($_POST['reset'])) { unset($_SESSION['gp']); $instance = new gpClassic($_POST['rowNumber']); $instance->rowNum(); } else { if (isset($_POST['rev']) && $_GET['rowNumber'] >= 2) { $_GET['rowNumber'] = $_GET['rowNumber'] - 1; $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } else { $_GET['rowNumber'] = $_GET['rowNumber'] + 1; $instance = new gpClassic($_GET['rowNumber']); $instance->rowNum(); } } ?> |
Dual Core, pls can u help me for the configuations of an intranet on internet information server(IIS)? |
*dhtml , did i right for the solution i provided for dose guyz, because i'm totally confused abt wht they are lookin where as an implementation of PHP & RDBMS(MYSQL) can solve easily. |
olabukky & jeezfreak7, pls make an attempt 2 downloads: if (window user) ,WAMP SERVER or separately (Apache, MYSQL, PHP), i'll back its up with configurations; for materials forward ur email address; |
mj , would mind 2 forward script within d range of form u created? |
Donpuzo, let forget abt d issue of dat,now can u configure an intranet on internet information server(IIS) or any suitable web server? |
Mark Donpuzo, why would u expect me 2 knw all, i stated PHP not integration of AJAX & PHP. |
Mark Donpuzo, i noticed u're a good detector, can u help me out 4 d solutions of dose syntax including my own? |
Donpuzo, i luv dat, hope u knw we are here 2 support one anoda, pls correct the code posted. |
pls explain the exert thing u want 2 do, forget abt the lang. u want use, i'm a specialist in Javascript, PHP & MYSQL. |
Explain an exert thing u wanted to do, forget abt the language u want 2 use,. To escape in PHP use for beginner: (1) <?php ?> //client scripting lang(html, css, xml,javascript/vbscript etc). goes here <?php ?> (2) heredoc <?php echo <<< TEXT //client scripting lang. goes here TEXT; ?> PHP is a server scripting language |
solution: escape the client scripting languages in PHP, then output it as PHP code or use database instead. |
It just dat i need challenges 4rm Nigerians PHP programmers, may be with time u'll get 2 knw if i worth to be called guru or not. |
I always feel proud of being a PHP programmer while i'm looking for novice, expert and wizard to share my experiences with, i also have materials to release for the progress of PHP programmers. |
I always feel proud of being a PHP programmer while i'm looking for novice, expert and wizard to share my experiences with, i also have materials to release for the progress of PHP programmers. |
would u mind to go into the world of web-programming ? If yes, be preparing yourself for the following languages: HTML5.0 & CSS3, Javascript/VbScript, XML,PHP & MYSQL, note: most of the listed languages has sub-langs to be treated along, I'm a PHP programmer, to reach me mail: info@campusconnects.net,campusconnectsng@yahoo.com or 08034309999 |
I'm a php programmer i need someone to help me for the configurations of an intranet on local server |
We offer bulk SMS at N2.5k /SMS for more details visit www.campusconnects.net or call 08034309999(Aliu). |
We offer bulk SMS at N2.5k /SMS, for details visit www.campusconnects.net or call 08034309999(Aliu) |
I offer bulk SMS @ N2.50k/SMS, for more details visit www.campusconnects.net or call 08034309999(Aliu). |
I'm interested in Javascript & PHP e-book, i also need an Intranet e-book. reach me thru : campusconnectsng@yahoo.com or info@campusconnects.net |
I'm a php programmer i need someone who can help me for the configurations of intranet on IIS7 or any other possible local server. |
1 (of 1 pages)
;
$go"