Registered: 14 years ago
Well, case is a powerful tool. Code neatly and code correctly - don't be lazy now BTW, there are reserved words in PHP which you cannot use to define variable - these a words PHP uses for itself. $case is one. Do a google for predefined php words. You use them, you will spent hours looking for a problem you did not know about.
$books["Romeo and Juliet"] = "William Shakespeare";
$books["Exobiology: An Introduction"] = "Jonathan Drake";
$books["War and Peace"] = "Leo Tolstoy";
$books["Portrait of the Artist"] = "James Joyce";
$books["The Lion, The Witch, and the Wardrobe"] = "CS Lewis";
$author = $books[$SelectedBook];
echo "The author of $SelectedBook is $author.";
When I view book.html and call the array, I get The author of is . in my browser. What am I doing wrong?