Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
PHP help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="wjlfernando" data-source="post: 5340916" data-attributes="member: 44901"><p>any one can fix this code's error</p><p></p><p>[HTML]<html></p><p><head></p><p></p><p><title>Course Progession</title></p><p><style type="text/css"></p><p><!--</p><p>.style1 {</p><p>color: #FFFFFF;</p><p>font-weight: bold;</p><p>}</p><p>--></p><p></style></p><p></head></p><p></p><p><body></p><p><?php</p><p>$firstName = @$_POST["Firstname"];</p><p>$surName = @$_POST["Surname"];</p><p>$studentId = @$_POST["StudentID"];</p><p>$courseType = @$_POST["CourseType"];</p><p></p><p>//dim $unitCode;</p><p>$unitCode = array($_POST["UnitCode_1"], $_POST["UnitCode_2"], $_POST["UnitCode_3"], $_POST["UnitCode_4"], $_POST["UnitCode_5"], $_POST["UnitCode_6"], $_POST["UnitCode_7"], $_POST["UnitCode_8"], $_POST["UnitCode_9"], $_POST["UnitCode_10"], $_POST["UnitCode_11"], $_POST["UnitCode_12"], $_POST["UnitCode_13"], $_POST["UnitCode_14"], $_POST["UnitCode_15"], $_POST["UnitCode_16"], $_POST["UnitCode_17"], $_POST["UnitCode_18"], $_POST["UnitCode_19"], $_POST["UnitCode_20"], $_POST["UnitCode_21"], $_POST["UnitCode_22"], $_POST["UnitCode_23"], $_POST["UnitCode_24"], $_POST["UnitCode_25"], $_POST["UnitCode_26"], $_POST["UnitCode_27"], $_POST["UnitCode_28"], $_POST["UnitCode_29"], $_POST["UnitCode_30"]);</p><p></p><p>//dim $noOfCreditPoints;</p><p>$noOfCreditPoints = array(@$_POST["CP_1"], $_POST["CP_2"], $_POST["CP_3"], $_POST["CP_4"], $_POST["CP_5"], $_POST["CP_6"], $_POST["CP_7"], $_POST["CP_8"], $_POST["CP_9"], $_POST["CP_10"], $_POST["CP_11"], $_POST["CP_12"], $_POST["CP_13"], $_POST["CP_14"], $_POST["CP_15"], $_POST["CP_16"], $_POST["CP_17"], $_POST["CP_18"], $_POST["CP_19"], $_POST["CP_20"], $_POST["CP_21"], $_POST["CP_22"], $_POST["CP_23"], $_POST["CP_24"], $_POST["CP_25"], $_POST["CP_26"], $_POST["CP_27"], $_POST["CP_28"], $_POST["CP_29"], $_POST["CP_30"]);</p><p></p><p>//dim $semester;</p><p>$semester = array(@$_POST["YS_1"], $_POST["YS_2"], $_POST["YS_3"], $_POST["YS_4"], $_POST["YS_5"], $_POST["YS_6"], $_POST["YS_7"], $_POST["YS_8"], $_POST["YS_9"], $_POST["YS_10"], $_POST["YS_11"], $_POST["YS_12"], $_POST["YS_13"], $_POST["YS_14"], $_POST["YS_15"], $_POST["YS_16"], $_POST["YS_17"], $_POST["YS_18"], $_POST["YS_19"], $_POST["YS_20"], $_POST["YS_21"], $_POST["YS_22"], $_POST["YS_23"], $_POST["YS_24"], $_POST["YS_25"], $_POST["YS_26"], $_POST["YS_27"], $_POST["YS_28"], $_POST["YS_29"], $_POST["YS_30"]);</p><p></p><p>//dim $marks;</p><p>$marks = array(@$_POST["UM_1"], $_POST["UM_2"], $_POST["UM_3"], $_POST["UM_4"], $_POST["UM_5"], $_POST["UM_6"], $_POST["UM_7"], $_POST["UM_8"], $_POST["UM_9"], $_POST["UM_10"], $_POST["UM_11"], $_POST["UM_12"], $_POST["UM_13"], $_POST["UM_14"], $_POST["UM_15"], $_POST["UM_16"], $_POST["UM_17"], $_POST["UM_18"], $_POST["UM_19"], $_POST["UM_20"], $_POST["UM_21"], $_POST["UM_22"], $_POST["UM_23"], $_POST["UM_24"], $_POST["UM_25"], $_POST["UM_26"], $_POST["UM_27"], $_POST["UM_28"], $_POST["UM_29"], $_POST["UM_30"]); //Getting the marks</p><p></p><p>$anyError = false;</p><p></p><p>$unitsAttempted = 0;</p><p></p><p>$passedUnits = 0;</p><p></p><p>$totalCreditPoints = 0;</p><p></p><p>$totalMarks = 0;</p><p></p><p></p><p></p><p>function validateStudentInfo($fName, $sName, $stdId) {</p><p></p><p>if($fName == NULL){</p><p>echo "Please enter your Firstname <br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>if($sName == NULL){</p><p>echo "Please enter your Surname <br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>if($stdId == NULL){</p><p>echo "Please enter your Student ID <br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>if($stdId <> NULL){</p><p>//dim $sID;</p><p>$sID = strlen($stdId);</p><p>if(($sID<8) OR (!is_numeric($stdId))){</p><p>echo "Please re-enter the Student ID, Student ID must be a 8 digit numeric <br />";</p><p>$anyError = true;</p><p>}</p><p>}</p><p>}</p><p></p><p></p><p></p><p>function displayStudentDetails ($fName, $sName, $stdId) {</p><p>echo "Name : ".($fName)." ".($sName);</p><p>echo "<br />Student ID : ".($stdId);</p><p>}</p><p></p><p></p><p></p><p>function displayCourseDetails($course) {</p><p></p><p>if($course == 1){</p><p>echo "<br /><br />You have chosen the Undergraduate Program";</p><p>}</p><p></p><p>if($course == 2){</p><p>echo "<br /><br />You have chosen the Graduate Diploma Program";</p><p>}</p><p></p><p>if($course == 3){</p><p>echo "<br /><br />You have chosen the Masters by Coursework Program";</p><p>}</p><p></p><p>if($course == 4){</p><p>echo "<br /><br />You have chosen the Masters by Research Program";</p><p>}</p><p></p><p>}</p><p></p><p></p><p></p><p>function validateCourseInfo($uCode, $cPoints, $sem, $mark) {</p><p>for ($counter=0; $counter<=29; $counter++) {</p><p></p><p>if(($uCode[$counter] <> NULL)AND($cPoints[$counter] <> "")AND($sem[$counter] <> "")AND($mark[$counter] <> ""))then;</p><p>//dim $uC;</p><p>$uC = strlen($uCode[$counter]);</p><p>if($uC <> 7)then;</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Unitcode should consist of 7 digits<br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>if(is_numeric($cPoints[$counter])){</p><p>if(($cPoints[$counter] <> 20) AND ($cPoints[$counter] <> 15)){</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Credit points only be either 15 or 20<br />";</p><p>$anyError = true;</p><p>}</p><p>} else {</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Credit points only be either 15 or 20<br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>//dim $smstr;</p><p>$smstr = strlen($sem[$counter]);</p><p>if (($smstr <> 3)OR(! is_numeric($sem[$counter]))){</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Semester must be a 3 digits numeric<br />";</p><p>$anyError = true;</p><p>}</p><p></p><p>if(is_numeric($mark[$counter])){</p><p>if($mark[$counter] > 100 OR 0 >= $mark[$counter]){</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Marks should be less than 100 or greater than 0<br />";</p><p>$anyError = true;</p><p>}</p><p>} else {</p><p>echo "<br />Please check row number ".($counter+1);</p><p>echo "<br />Marks should be less than 100 or greater than 0<br />";</p><p>$anyError = true;</p><p>}</p><p></p><p></p><p></p><p></p><p></p><p></p><p>function findAndCalculateCourseDetails($cPoints, $mark) {</p><p></p><p>for ($counter=0; $counter<=29; $counter++) {</p><p>if($mark[$counter]<>NULL){</p><p>if($mark[$counter]<=100 AND $mark[$counter]>=0)then;</p><p>$unitsAttempted = $unitsAttempted+1;</p><p>$totalMarks = $totalMarks + $mark[$counter];</p><p></p><p>if($mark[$counter]>=50){</p><p>$numberOfPassedUnits = $numberOfPassedUnits+1;</p><p>$totalCreditPoints = $totalCreditPoints+$cPoints[$counter];</p><p>}</p><p>}</p><p>}</p><p>}</p><p></p><p>echo "<br /><br />You have Total of ".$totalMarks." Marks";</p><p>echo "<br />Your have ".totalCreditPoints." credit points";</p><p>echo "<br /><br />You have attempted ".$unitsAttempted." times";</p><p>echo "<br />You have successlully completed ".numberOfPassedUnits." units";</p><p></p><p>}</p><p></p><p></p><p></p><p>function calculateRequiredCreditPoints ($totalCreditPoints, $course) {</p><p></p><p>//dim $pointsRequired;</p><p>if($course == 1){</p><p>$pointsRequired = 360 - $totalCreditPoints;</p><p>}</p><p></p><p>if($course == 2){</p><p>$pointsRequired = 120 - $totalCreditPoints;</p><p>}</p><p></p><p>if($course == 3){</p><p>$pointsRequired = 180 - $totalCreditPoints;</p><p>}</p><p></p><p>if($course == 4){</p><p>$pointsRequired = 240 - $totalCreditPoints;</p><p>}</p><p></p><p></p><p>if($pointsRequired > 0){</p><p>echo "<br /><br />You Need Another ".$pointsRequired." marks to complete the selected program";</p><p></p><p>} else {</p><p>echo "<br /><br />Congratulations!! You have successfully completed the selected program";</p><p>}</p><p></p><p>}</p><p></p><p></p><p></p><p>function calculateCourseAvg ($totalMarks, $unitsAttempted) {</p><p>if($unitsAttempted>0){</p><p>//dim $average;</p><p>$average = $totalMarks/$unitsAttempted;</p><p></p><p></p><p>if($average <50){</p><p>echo "<br /><br />Your Average is ".$average." and Your Grade is F - Fail";</p><p>} elseif($average <60){</p><p>echo "<br /><br />Your Average is ".$average." and Your Grade is C - Simple Pass";</p><p>} elseif($average <70){</p><p>echo "<br /><br />Your Average is ".$average." and Your Grade is Cr - Credit pass";</p><p>} elseif($average <80){</p><p>echo "<br /><br />Your Average is ".$average." and Your Grade is D - Distinction";</p><p>} else {</p><p>echo "<br /><br />Your Average is ".$average." and Your Grade is HD - High Distinction";</p><p>}</p><p>}</p><p>} //</p><p></p><p></p><p>validateStudentInfo($firstName, $surName, $studentId);</p><p></p><p></p><p>validateCourseInfo($unitCode, $noOfCreditPoints, $semester, $marks);</p><p></p><p></p><p>if($anyError == false){</p><p> displayStudentDetails($firstName, $surName, $studentId);</p><p> displayCourseDetails($courseType);</p><p> findAndCalculateCourseDetails($noOfCreditPoints, $marks);</p><p> calculateRequiredCreditPoints (totalCreditPoints, $courseType);</p><p> calculateCourseAvg ($totalMarks, $unitsAttempted);</p><p>}</p><p>?></p><p></body></p><p></html>[/HTML]</p></blockquote><p></p>
[QUOTE="wjlfernando, post: 5340916, member: 44901"] any one can fix this code's error [HTML]<html> <head> <title>Course Progession</title> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <body> <?php $firstName = @$_POST["Firstname"]; $surName = @$_POST["Surname"]; $studentId = @$_POST["StudentID"]; $courseType = @$_POST["CourseType"]; //dim $unitCode; $unitCode = array($_POST["UnitCode_1"], $_POST["UnitCode_2"], $_POST["UnitCode_3"], $_POST["UnitCode_4"], $_POST["UnitCode_5"], $_POST["UnitCode_6"], $_POST["UnitCode_7"], $_POST["UnitCode_8"], $_POST["UnitCode_9"], $_POST["UnitCode_10"], $_POST["UnitCode_11"], $_POST["UnitCode_12"], $_POST["UnitCode_13"], $_POST["UnitCode_14"], $_POST["UnitCode_15"], $_POST["UnitCode_16"], $_POST["UnitCode_17"], $_POST["UnitCode_18"], $_POST["UnitCode_19"], $_POST["UnitCode_20"], $_POST["UnitCode_21"], $_POST["UnitCode_22"], $_POST["UnitCode_23"], $_POST["UnitCode_24"], $_POST["UnitCode_25"], $_POST["UnitCode_26"], $_POST["UnitCode_27"], $_POST["UnitCode_28"], $_POST["UnitCode_29"], $_POST["UnitCode_30"]); //dim $noOfCreditPoints; $noOfCreditPoints = array(@$_POST["CP_1"], $_POST["CP_2"], $_POST["CP_3"], $_POST["CP_4"], $_POST["CP_5"], $_POST["CP_6"], $_POST["CP_7"], $_POST["CP_8"], $_POST["CP_9"], $_POST["CP_10"], $_POST["CP_11"], $_POST["CP_12"], $_POST["CP_13"], $_POST["CP_14"], $_POST["CP_15"], $_POST["CP_16"], $_POST["CP_17"], $_POST["CP_18"], $_POST["CP_19"], $_POST["CP_20"], $_POST["CP_21"], $_POST["CP_22"], $_POST["CP_23"], $_POST["CP_24"], $_POST["CP_25"], $_POST["CP_26"], $_POST["CP_27"], $_POST["CP_28"], $_POST["CP_29"], $_POST["CP_30"]); //dim $semester; $semester = array(@$_POST["YS_1"], $_POST["YS_2"], $_POST["YS_3"], $_POST["YS_4"], $_POST["YS_5"], $_POST["YS_6"], $_POST["YS_7"], $_POST["YS_8"], $_POST["YS_9"], $_POST["YS_10"], $_POST["YS_11"], $_POST["YS_12"], $_POST["YS_13"], $_POST["YS_14"], $_POST["YS_15"], $_POST["YS_16"], $_POST["YS_17"], $_POST["YS_18"], $_POST["YS_19"], $_POST["YS_20"], $_POST["YS_21"], $_POST["YS_22"], $_POST["YS_23"], $_POST["YS_24"], $_POST["YS_25"], $_POST["YS_26"], $_POST["YS_27"], $_POST["YS_28"], $_POST["YS_29"], $_POST["YS_30"]); //dim $marks; $marks = array(@$_POST["UM_1"], $_POST["UM_2"], $_POST["UM_3"], $_POST["UM_4"], $_POST["UM_5"], $_POST["UM_6"], $_POST["UM_7"], $_POST["UM_8"], $_POST["UM_9"], $_POST["UM_10"], $_POST["UM_11"], $_POST["UM_12"], $_POST["UM_13"], $_POST["UM_14"], $_POST["UM_15"], $_POST["UM_16"], $_POST["UM_17"], $_POST["UM_18"], $_POST["UM_19"], $_POST["UM_20"], $_POST["UM_21"], $_POST["UM_22"], $_POST["UM_23"], $_POST["UM_24"], $_POST["UM_25"], $_POST["UM_26"], $_POST["UM_27"], $_POST["UM_28"], $_POST["UM_29"], $_POST["UM_30"]); //Getting the marks $anyError = false; $unitsAttempted = 0; $passedUnits = 0; $totalCreditPoints = 0; $totalMarks = 0; function validateStudentInfo($fName, $sName, $stdId) { if($fName == NULL){ echo "Please enter your Firstname <br />"; $anyError = true; } if($sName == NULL){ echo "Please enter your Surname <br />"; $anyError = true; } if($stdId == NULL){ echo "Please enter your Student ID <br />"; $anyError = true; } if($stdId <> NULL){ //dim $sID; $sID = strlen($stdId); if(($sID<8) OR (!is_numeric($stdId))){ echo "Please re-enter the Student ID, Student ID must be a 8 digit numeric <br />"; $anyError = true; } } } function displayStudentDetails ($fName, $sName, $stdId) { echo "Name : ".($fName)." ".($sName); echo "<br />Student ID : ".($stdId); } function displayCourseDetails($course) { if($course == 1){ echo "<br /><br />You have chosen the Undergraduate Program"; } if($course == 2){ echo "<br /><br />You have chosen the Graduate Diploma Program"; } if($course == 3){ echo "<br /><br />You have chosen the Masters by Coursework Program"; } if($course == 4){ echo "<br /><br />You have chosen the Masters by Research Program"; } } function validateCourseInfo($uCode, $cPoints, $sem, $mark) { for ($counter=0; $counter<=29; $counter++) { if(($uCode[$counter] <> NULL)AND($cPoints[$counter] <> "")AND($sem[$counter] <> "")AND($mark[$counter] <> ""))then; //dim $uC; $uC = strlen($uCode[$counter]); if($uC <> 7)then; echo "<br />Please check row number ".($counter+1); echo "<br />Unitcode should consist of 7 digits<br />"; $anyError = true; } if(is_numeric($cPoints[$counter])){ if(($cPoints[$counter] <> 20) AND ($cPoints[$counter] <> 15)){ echo "<br />Please check row number ".($counter+1); echo "<br />Credit points only be either 15 or 20<br />"; $anyError = true; } } else { echo "<br />Please check row number ".($counter+1); echo "<br />Credit points only be either 15 or 20<br />"; $anyError = true; } //dim $smstr; $smstr = strlen($sem[$counter]); if (($smstr <> 3)OR(! is_numeric($sem[$counter]))){ echo "<br />Please check row number ".($counter+1); echo "<br />Semester must be a 3 digits numeric<br />"; $anyError = true; } if(is_numeric($mark[$counter])){ if($mark[$counter] > 100 OR 0 >= $mark[$counter]){ echo "<br />Please check row number ".($counter+1); echo "<br />Marks should be less than 100 or greater than 0<br />"; $anyError = true; } } else { echo "<br />Please check row number ".($counter+1); echo "<br />Marks should be less than 100 or greater than 0<br />"; $anyError = true; } function findAndCalculateCourseDetails($cPoints, $mark) { for ($counter=0; $counter<=29; $counter++) { if($mark[$counter]<>NULL){ if($mark[$counter]<=100 AND $mark[$counter]>=0)then; $unitsAttempted = $unitsAttempted+1; $totalMarks = $totalMarks + $mark[$counter]; if($mark[$counter]>=50){ $numberOfPassedUnits = $numberOfPassedUnits+1; $totalCreditPoints = $totalCreditPoints+$cPoints[$counter]; } } } } echo "<br /><br />You have Total of ".$totalMarks." Marks"; echo "<br />Your have ".totalCreditPoints." credit points"; echo "<br /><br />You have attempted ".$unitsAttempted." times"; echo "<br />You have successlully completed ".numberOfPassedUnits." units"; } function calculateRequiredCreditPoints ($totalCreditPoints, $course) { //dim $pointsRequired; if($course == 1){ $pointsRequired = 360 - $totalCreditPoints; } if($course == 2){ $pointsRequired = 120 - $totalCreditPoints; } if($course == 3){ $pointsRequired = 180 - $totalCreditPoints; } if($course == 4){ $pointsRequired = 240 - $totalCreditPoints; } if($pointsRequired > 0){ echo "<br /><br />You Need Another ".$pointsRequired." marks to complete the selected program"; } else { echo "<br /><br />Congratulations!! You have successfully completed the selected program"; } } function calculateCourseAvg ($totalMarks, $unitsAttempted) { if($unitsAttempted>0){ //dim $average; $average = $totalMarks/$unitsAttempted; if($average <50){ echo "<br /><br />Your Average is ".$average." and Your Grade is F - Fail"; } elseif($average <60){ echo "<br /><br />Your Average is ".$average." and Your Grade is C - Simple Pass"; } elseif($average <70){ echo "<br /><br />Your Average is ".$average." and Your Grade is Cr - Credit pass"; } elseif($average <80){ echo "<br /><br />Your Average is ".$average." and Your Grade is D - Distinction"; } else { echo "<br /><br />Your Average is ".$average." and Your Grade is HD - High Distinction"; } } } // validateStudentInfo($firstName, $surName, $studentId); validateCourseInfo($unitCode, $noOfCreditPoints, $semester, $marks); if($anyError == false){ displayStudentDetails($firstName, $surName, $studentId); displayCourseDetails($courseType); findAndCalculateCourseDetails($noOfCreditPoints, $marks); calculateRequiredCreditPoints (totalCreditPoints, $courseType); calculateCourseAvg ($totalMarks, $unitsAttempted); } ?> </body> </html>[/HTML] [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom