PhP anyone? - help!

  • Thread starter Thread starter Name
  • Start date Start date
  • Replies Replies 12
  • Views Views 2K

Name

Senior Member
Messages
95
Reaction score
9
Gender
Male
Religion
Islam
:sl:

i wanna assign to variables my name and a mark (between 1-25). And Convert this mark out of 25 to a percentage. If the percentage is 70% or more print out the statement, with my name on and sayin you are a first class student!”
but i donno how to start it off so could some start it off for us please not askin to do all of it jus start it off. thank you

:confused:
 
woah......such a confusion matter.....

am utterly confused...which subject is it for?..php...odd.....heard tis somewhere...science rite?
 
thats like the third ive been called silly.....:embarrass ........:rant: ......

i still dnt get it?.......
 
:sl: sis,
He is apparently trying to create a program that will interpret exam scores, and he needs to use the PHP programming language. Its just one of about a gazillion computer languages...but he chose the one I have not used for a while...So I can't help, unless I go to look it up...give me a couple hours brother (hopefully someone else will come to the rescue in the mean-time).

And sis, you are not silly...computer nerds are the silly ones :hiding:

:w:
 
:sl:
Brother, here is a pretty good site that I used to utilize all the time, when learning web development: http://www.w3schools.com/php/default.asp InshaAllah, you will find to be of benefit.

But first you need to store the name and score into variables, then perform your calculation to convert the score to a percentage, and then echo back the calculation. I would guess it would go something like this:

<?php
$name = "studentName"
$score = 23;
$calculation = ( 23 / 25 ) * 100;
if ($calculation >= 70)
echo $name + ", you are a first class student!";
elseif ($calculation < 70)
echo $name + ", better luck next time. Your score was " + $calculation;
?>

How are you reading the scores in? Are you reading it from a file? Or typing it in at the command prompt? Or asking the user to input it into a form on a web page? The last option would make the most sense. So you will find everything you need on that website I linked.

Dunno if that helped, if it was too much or too little...but it was fun for me so I will go bye-bye now :)

:w:
 
:sl:

How are you reading the scores in?

Dunno if that helped, if it was too much or too little...but it was fun for me so I will go bye-bye now :)

:w:

thanks for your attemp but that what i got: ERROR - to say the least


im just adding the scores by my self (typing them in)
 
thanks for your attemp but that what i got: ERROR - to say the least
im just adding the scores by my self (typing them in)
:sl:
I believe I need PHP installed in order to test it, and I am not even going to go there.

One source of the error probably is here:
Code:
echo $name + ", better luck next time. Your score was " + $calculation;

Try changing it to: (where the + signs is replaced with a . )
Code:
echo $name . ", better luck next time. Your score was " . $calculation;

Would also help if it tells what the error is, rather than just ERROR. And yeah, that is not perfect code I threw out here...its just a push in the right direction (hopefully). Sorry its not enough :)
 
Last edited:
isnt this stuff done on microsoft excel?

because i remem we had a whole module on this :p and no one understood anytin :D:D:D
 
:sl:
I believe I need PHP installed in order to test it, and I am not even going to go there.

One source of the error probably is here:
Code:
echo $name + ", better luck next time. Your score was " + $calculation;

Try changing it to: (where the + signs is replaced with a . )
Code:
echo $name . ", better luck next time. Your score was " . $calculation;

Would also help if it tells what the error is, rather than just ERROR. And yeah, that is not perfect code I threw out here...its just a push in the right direction (hopefully). Sorry its not enough :)
still incorrect
 
I DID A FEW TWICKS AND GUESS WHAT IT [BANANA]WORKED!!!!!!!!!!!!!!!!!!!!!!!!![/BANANA]

jazzakAllah to all those brothers and sisters
 
:sl:
Shouldn't the bit in red be:
$calculation = ( $score/ 25 ) * 100;

:p


Yep, but I wanted him to see it for himself! :p
And, tell me what your twicks were, brother YaRusulallah, so I can learn a lil somethin somethin! :)
 

Similar Threads

Back
Top