Page 1 of 1
information
Posted: Wed Jul 20, 2016 12:37 pm
by Daniyal
Code: Select all
<html>
<head>
<title> conditions </title>
</head>
<body>
<?php
$items = 10;
if($items > 5) {
echo "You get a 10% discount!";
}
else {
echo "You get a 5% discount!";
}
?>
</body>
</html>
Tell me the error in this code ??????? plz tell me
this msg is shown (Oops, try again. It looks like you didn't print anything! ) why ?????
Re: information
Posted: Wed Jul 20, 2016 12:51 pm
by Celauran
There's nothing wrong with that code. What is this error message and where is it coming from?
Re: information
Posted: Wed Jul 20, 2016 1:30 pm
by requinix
Are you doing the Codeacademy thing? Did you see the part about making the code output the 5% discount?
Re: information
Posted: Thu Jul 28, 2016 5:14 am
by Daniyal
yes
Re: information
Posted: Thu Jul 28, 2016 11:59 am
by Christopher
Daniyal wrote:yes
requinix asked two questions. Is that an answer to the first question or both?
Re: information
Posted: Thu Jul 28, 2016 1:37 pm
by Daniyal
first i am doing the codeacademy course

Re: information
Posted: Thu Jul 28, 2016 2:36 pm
by requinix
So you did not see the part about making the code output the 5% discount? 10 is greater than 5 so your code will output the 10% discount. And the error message mean not you didn't output anything but that you didn't output the correct response.
Take a look at the original code they presented. $items did not have a value of 10. The previous course did have you change the value, but that was a different thing.
Re: information
Posted: Thu Jul 28, 2016 2:47 pm
by Daniyal
ok i have done it

thnx
Re: information
Posted: Thu Jul 28, 2016 2:49 pm
by Daniyal
one more thing
anyone plz go to this link and tell me the write code plz using instructions ????
https://www.codecademy.com/courses/web- ... dd89003eb8#
Re: information
Posted: Thu Jul 28, 2016 3:01 pm
by requinix
If you tell you the answer then you won't be learning, will you?
Re: information
Posted: Thu Jul 28, 2016 6:44 pm
by Christopher
For 01 they show you the answer in the example. You should be able to do 02. Show us your idea for 03.