RHOD Posted June 24, 2009 Share Posted June 24, 2009 Ok so i am just starting out and i am learning from a PHP book that i have. My question is when i write a statement like the one below, which may have mistakes what ever its just an example.. I understand the coding and what it is doing etc but the book never explains how to use that code where do i state the students score so that the code will use it and it will display the information in the echo statement below, im just getting annoyed at learning the code but not know or being able to put it into use and as i am a learner i don't really know until the book tells me Any help pleassse??? Thanks ??? ??? <?PHP if ( condition ) { $grade = "A"; $message = "Excellent"; } elseif ($score <= 92 and $score > 83 ) { $grade = "B"; $message = "Good work"; } elseif ($score <= 83 and $score > 74 ) { $grade = "C"; $message = "OK" } elseif ($score <= 74 and $score > 62) { $grade = "D"; $message = "You suck"; } else { $grade = "F"; $message = "Doom On You!" } echo $message. "\n"; echo "Your grade is $grade\n"; ?> Link to comment https://forums.phpfreaks.com/topic/163454-explenation-on-displaying-results-learner/ Share on other sites More sharing options...
PugJr Posted June 24, 2009 Share Posted June 24, 2009 Add this right below "<?php". $score = (what you want); EDIT: Remember to remove the paranthesis so like: $score = 56; Link to comment https://forums.phpfreaks.com/topic/163454-explenation-on-displaying-results-learner/#findComment-862468 Share on other sites More sharing options...
RHOD Posted June 24, 2009 Author Share Posted June 24, 2009 Hi thanks for the info that did help in this case didnt explain why or how but thats ok I do have a couple of more queries, Does my wamp server always have to be running in order to preview the php on my computer? and how or could i create a simple form so say the teacher can enter the students score on a html based page and have the php then display the result rather then having to enter the it into the php coding itself? is it a simple thing to do ??? Link to comment https://forums.phpfreaks.com/topic/163454-explenation-on-displaying-results-learner/#findComment-862473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.