Help is greatly appreciated. I am working on a code that needs to have the capabilities as this link:
http://athena.ecs.csus.edu/~cs010142/Greeting_tree.php
Exclude the background color and the blinking. I think there is away to set up arrays to make it do this but having difficulty. This is my code so far:
<?php
/*
Your brief description of this program which may include input, output, requirements, and your design highlights
*/
include_once("gt_functions.php");
# MAIN-PROGRAM
$title = "The Greeting Trees";
html_begin ($title, $title);
if ($submit)
{
$size=$_POST['size'];
$tree=$_POST['tree'];
$type=$_POST['type'];
if (($size == "") || (!$tree))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot
to supply some information. </b></font><br>");
}
else if ((!ereg("[0-9]",$size))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict
your input to only numbers.</b></font><br>");
}
else if (($size < "12")|| ($size > "24"))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Out of range</b></font><br>");
}
}
if else (!$type)
{
echo "<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please select tree type. </b></font><br>");
}
else
{
//set up the data in a 2-dimensional array to mark the background
$A =array(array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"));
//this array A is 11x11, therefore the center of a row is 5
$N = 11;
$center = 5;
//mark tree leaves
for ($i=0; $i < 5; $i++)
{
for($j= ($center - $i); $j<= ($center + $i); $j++)
{
$A[$i+2][$j]= "*";
}
}
//mark tree trunk
for ($i = 7; $i < 10; $i++)
{
$A[$i][$center] = "*";
}
//display elements of the array in colors of the tree type
for ($i=0; $i< $N; $i++)
{
for($j=0; $j< $N; $j++)
{
DisplayChar ($type, $A[$i][$j]);
}
echo "<BR>";
}
DisplayGreeting($type);
}
}
//Form to collect user input: one of the 3 greeting tree types
?>
<FORM METHOD="post" ACTION="Greeting_tree.php">
<p>Please enter a tree size between 12 and 24:</p>
<input type="text" name="size" />
<p>Select tree type:</p>
<input type="radio" name="tree" value="Holiday" /> Holiday
<input type="radio" name="tree" value="SacState" /> SacState
<input type="radio" name="tre
http://athena.ecs.csus.edu/~cs010142/Greeting_tree.php
Exclude the background color and the blinking. I think there is away to set up arrays to make it do this but having difficulty. This is my code so far:
<?php
/*
Your brief description of this program which may include input, output, requirements, and your design highlights
*/
include_once("gt_functions.php");
# MAIN-PROGRAM
$title = "The Greeting Trees";
html_begin ($title, $title);
if ($submit)
{
$size=$_POST['size'];
$tree=$_POST['tree'];
$type=$_POST['type'];
if (($size == "") || (!$tree))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot
to supply some information. </b></font><br>");
}
else if ((!ereg("[0-9]",$size))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict
your input to only numbers.</b></font><br>");
}
else if (($size < "12")|| ($size > "24"))
{
echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Out of range</b></font><br>");
}
}
if else (!$type)
{
echo "<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please select tree type. </b></font><br>");
}
else
{
//set up the data in a 2-dimensional array to mark the background
$A =array(array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"),
array("0","0","0","0","0","0","0","0","0","0","0"));
//this array A is 11x11, therefore the center of a row is 5
$N = 11;
$center = 5;
//mark tree leaves
for ($i=0; $i < 5; $i++)
{
for($j= ($center - $i); $j<= ($center + $i); $j++)
{
$A[$i+2][$j]= "*";
}
}
//mark tree trunk
for ($i = 7; $i < 10; $i++)
{
$A[$i][$center] = "*";
}
//display elements of the array in colors of the tree type
for ($i=0; $i< $N; $i++)
{
for($j=0; $j< $N; $j++)
{
DisplayChar ($type, $A[$i][$j]);
}
echo "<BR>";
}
DisplayGreeting($type);
}
}
//Form to collect user input: one of the 3 greeting tree types
?>
<FORM METHOD="post" ACTION="Greeting_tree.php">
<p>Please enter a tree size between 12 and 24:</p>
<input type="text" name="size" />
<p>Select tree type:</p>
<input type="radio" name="tree" value="Holiday" /> Holiday
<input type="radio" name="tree" value="SacState" /> SacState
<input type="radio" name="tre