Jump to content
Larry Ullman's Book Forums

chrislancaster

Members
  • Posts

    3
  • Joined

  • Last visited

chrislancaster's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. OK got it ... thanks for everything ..I think I'll re-read the chapter to get a better understanding of { } Thanks again
  2. I have checked and re-checked and it's the same as whats in the book. Here's what I wrote: <!-- To change this template, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8\iso-8859-1"> <title>Multidimensional Arrays</title> </head> <body> <p> Some North American states, provinces and territories:</p> <?php // script 2.7 - multi.php // create one array $mexico = array('YU' => 'Yucatan', 'BC' => 'Baja California', 'Qa' => 'Oaxaca'); // create anther array $us = array('MD' => 'Maryland', 'IL' => 'Illinois', 'PA' => '*ennsylvania', 'IA' => 'Illinois'); // create a third array $canda = array('QC' => 'Quebec', 'AB' => 'Alberta', 'NT' => 'Northwest Territories', 'YT' => 'Yukon', 'PE' => 'Prince Edward Island'); // combine the arrays $n_america = array('Mexico' => '$mexico', 'United States' => '$us', 'Canada' => '$canada'); //Loop through countries foreach ($n_america as $country => $list) //print a heading echo "<h2>$country</h2><ul>"; //Print each state, province, or territory: foreach ($list as $k => $v) { echo "<li>$k - $v</li>\n"; } //close the list : echo'</ul>'; ?> </body> </html> I also get this error --Warning: Invalid argument supplied for foreach() in C:\Users\Owner\Desktop\xampp\htdocs\xampp\multi.php on line 47 if you can help I would greatly appreciate it ..none of the array scripts have worked for me
  3. I love the book! I installed xampp and using netbeans 6.9.1 IDE ... the question I have is when i write script 2.6 and 2.7 the drop boxes are created but the arrays dont work the boxes have no options to choose from, they are blank.. does anyone know why? Thanks in advance -Chris
×
×
  • Create New...