Hi there,
I wrote the following code:
and
The problem is that i cannot pass all the checked presidents in order to print them. A warning occurs "Warning: Illegal offset type in ". Does anyone know how to solve this problem??
Thanks a lot!
I wrote the following code:
Code:
<html>
<head>
<title> A21P7 </title>
</head>
<body>
<form action="A21P7.php" method="post" >
<?php
$Presidents = array('Washington,George', 'Adams,John', 'Jefferson,Thomas', 'Madison,James');
print "<b>Selection President</b><BR>";
foreach ( $Presidents as $index => $person ) {
print "<input type=\"checkbox\" name=\"chairman[]\" value=$person> $person";
print "<br/>";
}
?>
</form>
</body>
</html>
and
Code:
<html>
<head>
<title>A21P7</title>
</head>
<body>
<?php
$chairman = $_POST["chairman"];
$choice = $_POST["buttonpressed"];
$presidents = array(
'Washington,George'=> array('Term' => '1789-1797', 'Brief Description' => 'Soldier, statesman, farmer, politician, and commander and chief of the Continental Army during the Revolutionary War.'),
'Adams,John' => array('Term' => '1797-1801', 'Brief Description' => 'Farmer, lawyer, political philosopher, diplomat, and politician. He was a leader for U.S. Independence.'),
'Jefferson,Thomas' => array('Term' => '1801-1809', 'Brief Description' => 'Architect, scientist, diplomat, author, and politician. He authored the Declaration of Independence.'),
'Madison,James' => array('Term' => '1809-1817','Brief Description' => 'One of the framers of the Virginia Constitution, the U.S. Bill of Rights, the U.S. Constitution, and the Federalists Essays.'));
if (!(count($chairman) == 0)){
print "<table border=1> <th> Name <th> Term <th> Brief description";
print "<tr> <td> $chairman </td>";
print "<td> {$presidents[$chairman]['Term']} </td>";
print "<td> {$presidents[$chairman]['Brief Description']} </td>";
} else {
print "No such president = $chairman ";
}
?>
</body>
</html>
The problem is that i cannot pass all the checked presidents in order to print them. A warning occurs "Warning: Illegal offset type in ". Does anyone know how to solve this problem??
Thanks a lot!