Login | Register | FAQ
Anonymous

Comment your Script (Lesson 7)

+ Post a reply

4 posts Page 1 of 1


Comment your Script (Lesson 7)

by LtCdr(ret)Nazri » Sat Nov 05, 2011 7:15 pm

Dear HTML.net

I have tested the code on PHP Lesson 7, there is an error and here is the new one. Basically it is from previous topics.


<html>
<head>
<title>Loops</title>
</head>
<body>

<?php

// Here we write color codes using three loops

// Red can be between 0 and 255
for ($intRed=0; $intRed<=255; $intRed=$intRed+30) {

// Green can be between 0 and 255
for ($intGreen=0; $intGreen<=255; $intGreen=$intGreen+30) {

// Blue can be between 0 and 255
for ($intBlue=0; $intBlue<=255; $intBlue=$intBlue+30) {

// The color code is made on the form rgb(red,green,blue)
$strColor="rgb(".$intRed. ",".$intGreen.",".$intBlue.")";

// Now we write the color code to the client
echo "<span style='color:" . $strColor . "'> " . $strColor . " </span>";

// Closes the loops
}
}
}

?>

Please have a look and if this is correct please adjust the code.
User avatar

LtCdr(ret)Nazri

  • Posts: 4
  • Joined: Tue Jul 05, 2011 9:12 am
  • Location: Germany

Re: Comment your Script (Lesson 7)

by HTML.net » Sat Nov 05, 2011 9:17 pm

Hi,

Thanks for taking time to write. What is the error?

All the best,

- Andreas, HTML.net
User avatar

HTML.net
Site Admin

  • Posts: 1194
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.

Re: Comment your Script (Lesson 7)

by LtCdr(ret)Nazri » Sat Nov 05, 2011 10:53 pm

HTML.net wrote:Hi,

Thanks for taking time to write. What is the error?

All the best,

- Andreas, HTML.net


The code has missed the $ sign.
I attach again and highlight the missing $. Since the Attachments for Words is not allowed so I will paste and hightlight the code here, just take a few time to adjust the highlight part. Moment please.

<html>
<head>
<title>Loops</title>
</head>
<body>

<?php

// Here we write color codes using three loops

// Red can be between 0 and 255
for ($intRed=0; $intRed<=255; $intRed=$intRed+30) {

// Green can be between 0 and 255
for ($intGreen=0; $intGreen<=255; $intGreen=$intGreen+30) {

// Blue can be between 0 and 255
for ($intBlue=0; $intBlue<=255; $intBlue=$intBlue+30) {

// The color code is made on the form rgb(red,green,blue)
$strColor="rgb(".$intRed. ",".$intGreen.",".$intBlue.")";

// Now we write the color code to the client
echo "<span style='color:" . $strColor . "'> " . $strColor . " </span>";

// Closes the loops
}
}
}

?>
User avatar

LtCdr(ret)Nazri

  • Posts: 4
  • Joined: Tue Jul 05, 2011 9:12 am
  • Location: Germany

Re: Comment your Script (Lesson 7)

by HTML.net » Sun Nov 06, 2011 7:15 am

It has ben corrected! Thank you very much!
User avatar

HTML.net
Site Admin

  • Posts: 1194
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.


+ Post a reply

Page 1 of 1