javascript
Brief description  about Online courses   join in Online courses
View rupa vishwanathan iyer 's Profile

arrays..

2) Using arrays create a table with one column, which lists all your favorite colors. Background of each table row should be same as the color named in the row.
3) Using arrays , create a two column table, that shows few states of India and capital cities of these states.PLZ GIVE ME A SAMPLE CODE FOR THESE TWO I AM NOT GETTING IT RIGHT.


U GAVE ME DYS CODE BUT DER SEEMS TO BE SUM ERROR WHICH I AM NOT ABLE TO FIND

$color[0]= 'Red';
$color[1]= 'Pink';
$color[2]= 'Orange';
$color[3]= 'Yellow';
$color[4]= 'Green';
$color[5]= 'Brown';
$color[6]= 'Violet';
$color[7]= 'Blue';
$color[8]= 'White';
$color[9]= 'Skyblue';
$color[10]= 'Maroon';

echo "<table border='1'>";

echo"<tr bgcolor='green'><th>FAVOURITE COLORS</th></tr>";


echo "<tr><td><p style="background-color:red">";
echo $color[0];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:pink">";
echo $color[1];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:orange">";
echo $color[2];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:yellow">";
echo $color[3];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:green">";
echo $color[4];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:brown">";
echo $color[5];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:violet">";
echo $color[6];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:blue">";
echo $color[7];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:white">";
echo $color[8];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:skyblue">";
echo $color[9];
echo "</p></td></tr>";

echo "<tr><td><p style="background-color:maroon">";
echo $color[10];
echo "</p></td></tr>";

echo "</table>";






echo"<h2>3) Using arrays , create a two column table, that shows few states of India and capital cities of these states.</h2>";


$states_capital = array (

"Delhi" => "New Delhi",
"TamilNadu" => "Chennai",
"Karnataka" => "Bangalore",
"Andhra Pradesh" => "Hyderabad",
"Kerala" => "Thiruvananthapuram",
"Goa" => "Panaji",
"Maharashtra" => "Mumbai",
"Bihar" => "Patna",
"Haryana" => "Chandigarh",

);



echo "<table border='1' cellpadding='5'>";

echo"<tr bgcolor='green'><th>STATES</th><th>CAPITAL</th></tr>";


foreach($states_capital as $States=>$Capital)
{
echo "<tr bgcolor='yellow'><td>$States </td><td>$Capital</td></tr> ";

}



echo "</table>";
reply soon i have already exceeded my submission date..
Asked by rupa vishwanathan iyer | Apr 28, 2011 |  Reply now
Replies (0)