puglover
10-12-2009, 03:04 AM
after working for about 3 days on this project i finally got most of it working..now i get this parsing error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/students/got5758/public_html/hmwk5.php on line 38
no one i've talked to can figure out whats wrong with my code. can someone help???
<?php
$rowcolors = array ("purple", "red", "yellow", "orange", "blue", "pink");
?>
<html>
<head>
<title>
</title>
<style type="text/css">
.rowcolor{
background : <?php echo $_GET['color']; ?>
}
</style>
</head>
<body>
Create a multiplication table<p>
<form method="get" action="<?php $_SERVER['php_self'];?> ">
Enter number of rows<br />
<input type="text" name="rownum" size="10" value="<?php echo $_GET['rownum'];?>"><p>
Enter number of columns<br />
<input type="text" name="colnum" size="10" value="<?php echo $_GET['colnum'];?>"><p>
Select a color<br />
<select name="color" value="<?php echo $_GET['color'];?>">
<?php
for ( $i = 0; $i < count( $rowcolors ); $i++ )
{
echo "<option value=\"" . $rowcolors[$i] . "\">" . $rowcolors[$i] . "</option>\n";
}
?>
</select>
<input type="hidden" name="do_php" value="true">
<p><input type="submit" value="Create Table">
</form>
<?php
if(isset($_GET['do_php']))
{
****echo "<table*width=\"50%\" border=\"3\">";
****echo*"<tr><td> </td>";
****
****for(*$i=1;*$i<=$_GET['colnum'];*$i++)
****{
********if($i%2==0)
{
echo "<tr class=\"rowcolor\">";
}
else
{
echo "<tr>";
}
echo"<td>".$i."</td>\n";
**** echo"</tr>\n";
**** for(*$j=1;*$j<=$_GET['rownum'];*$j++)
**** {
******** if($j%2==0)*********
******** {
echo*"<tr*class=\"rowcolor\">";
*** }
else*
******** {
echo"<tr>";
******** }
********echo"<td>".$j."</td>\n";
}
******** for(*$k=1;*$k<=$_GET['colnum'];*$k++)
******* {
************ echo"<td>".$j*$k."</td>\n";
******* }
****
****
}
****echo"</tr>\n";
****echo"</div>\n";
}
echo"</table>\n";
?>
</body>
</html>
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/students/got5758/public_html/hmwk5.php on line 38
no one i've talked to can figure out whats wrong with my code. can someone help???
<?php
$rowcolors = array ("purple", "red", "yellow", "orange", "blue", "pink");
?>
<html>
<head>
<title>
</title>
<style type="text/css">
.rowcolor{
background : <?php echo $_GET['color']; ?>
}
</style>
</head>
<body>
Create a multiplication table<p>
<form method="get" action="<?php $_SERVER['php_self'];?> ">
Enter number of rows<br />
<input type="text" name="rownum" size="10" value="<?php echo $_GET['rownum'];?>"><p>
Enter number of columns<br />
<input type="text" name="colnum" size="10" value="<?php echo $_GET['colnum'];?>"><p>
Select a color<br />
<select name="color" value="<?php echo $_GET['color'];?>">
<?php
for ( $i = 0; $i < count( $rowcolors ); $i++ )
{
echo "<option value=\"" . $rowcolors[$i] . "\">" . $rowcolors[$i] . "</option>\n";
}
?>
</select>
<input type="hidden" name="do_php" value="true">
<p><input type="submit" value="Create Table">
</form>
<?php
if(isset($_GET['do_php']))
{
****echo "<table*width=\"50%\" border=\"3\">";
****echo*"<tr><td> </td>";
****
****for(*$i=1;*$i<=$_GET['colnum'];*$i++)
****{
********if($i%2==0)
{
echo "<tr class=\"rowcolor\">";
}
else
{
echo "<tr>";
}
echo"<td>".$i."</td>\n";
**** echo"</tr>\n";
**** for(*$j=1;*$j<=$_GET['rownum'];*$j++)
**** {
******** if($j%2==0)*********
******** {
echo*"<tr*class=\"rowcolor\">";
*** }
else*
******** {
echo"<tr>";
******** }
********echo"<td>".$j."</td>\n";
}
******** for(*$k=1;*$k<=$_GET['colnum'];*$k++)
******* {
************ echo"<td>".$j*$k."</td>\n";
******* }
****
****
}
****echo"</tr>\n";
****echo"</div>\n";
}
echo"</table>\n";
?>
</body>
</html>