Jump to content

Gzyms

New Members
  • Posts

    3
  • Joined

  • Last visited

Gzyms's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you Guys! Hope soon I will be better in PHP:)
  2. Hi, Ok, I'm on a course and the guy told us to create a tree (and well he accepted this mess or maybe he was just fed up with me^^). $numberofLines is suppose to make the tree bigger. So for example when you enter "10", tree would be 10 lines. Thanks!
  3. PHP Tree Hi Guys, I am a beginner so my question may seem simple I have a "tree", I want to make it possible to change tree's size when someone enters number of lines into the box "Send". Code: PHP Code: <html> <body> <form method="GET" action="tree.php"> <label for="numberofLines" value="shownumberofLines"> <input type="text" name="numberofLines"> <input type="submit" value="Send"> </form> <table> <?php $numberofLines = !empty($_GET['numberofLines']) ? $_GET['numberofLines'] : 5; var_dump($numberofLines); $a = '<td style="background-color:white"> </td>'; $b = '<td style="background-color:green"> </td>'; $c = '<td style="background-color:brown"> </td>'; $d = '<td style="background-color:yellow"> </td>'; for ($i = 0; $i < 4; $i++) { echo $a; } for ($i = 0; $i < 1; $i++) { echo $d; } for ($i = 0; $i < 2; $i++) { echo $a; } echo "<tr>"; for ($i = 0; $i < 2; $i++) { echo $a; } for ($i = 0; $i < 5; $i++) { echo $b; } echo "</tr>"; echo "<tr>"; for ($i = 0; $i < 0; $i++) { echo $a; } for ($i = 0; $i < 9; $i++) { echo $b; } echo "</tr>"; echo "<tr>"; for ($i = 0; $i < 4; $i++) { echo $a; } for ($i = 0; $i < 1; $i++) { echo $c; } echo "</tr>"; ?> </table> </body> Thank You in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.