Forum : Plz help me with the below coding....
Brief description  about Online courses   join in Online courses
View Sweety  Agarwal 's Profile

Plz help me with the below coding....

Sir,plz check out the code below as its nt working properly..its nt displaying the value i want..

<?php
$pro = array(
"cap" => array
(
"state" => "Delhi",
"capital" => "India",
),

"capi" => array
(
"state" => "Andhra Pradesh",
"capital" => "Hyderabad",
),

"capit" => array
(
"state" => "Assam",
"capital" => "Dispur",
),

"capita" => array
(
"state" => "Goa",
"capital" => "Panaji",
)
);
echo"<table><tr><th>State</th><th>Capital</th></tr>";
echo "<tr><td> $pro ['cap']['state']</td><td>$pro ['cap']['capital']</td></tr>";
echo "<tr><td> $pro ['capi']['state']</td><td>$pro ['capi']['capital']</td></tr>";
echo "<tr><td> $pro ['capit']['state']</td><td>$pro ['capit']['capital']</td></tr>";
echo "<tr><td> $pro ['capita']['state']</td><td>$pro ['capita']['capital']</td></tr>";
echo"</table>";
?>

Output i m getting from the above code is:----

State Capital
Array ['cap']['state'] Array ['cap']['capital']
Array ['capi']['state'] Array ['capi']['capital']
Array ['capit']['state'] Array ['capit']['capital']
Array ['capita']['state'] Array ['capita']['capital']

but i want it in this way:--

State Capital
Delhi India
Andhra pradesh Hyderbad
Assam Dispur
Goa Panaji

PLEASE REPLY SOON...
Asked by Sweety Agarwal | Dec 16, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
<?php
$pro = array(
"cap" => array
(
"state" => "Delhi",
"capital" => "India",
),

"capi" => array
(
"state" => "Andhra Pradesh",
"capital" => "Hyderabad",
),

"capit" => array
(
"state" => "Assam",
"capital" => "Dispur",
),

"capita" => array
(
"state" => "Goa",
"capital" => "Panaji",
)
);
echo"<table><tr><th>State</th><th>Capital</th></tr>";
echo "<tr><td>". $pro ['cap']['state']."</td><td>".$pro['cap']['capital']."</td></tr>";
echo "<tr><td>". $pro ['capi']['state']."</td><td>".$pro['capi']['capital']."</td></tr>";
echo "<tr><td>". $pro ['capita']['state']."</td><td>".$pro['capita']['capital']."</td></tr>";

echo"</table>";
?>
Dec 23, 2010