Lively discussions on the graphic arts and publishing — in print or on the web

Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-17-2008, 09:33 AM   #1
Join Date: Oct 2005
Location: Manchester, NH
Posts: 65
Default PHP interpreter dying - why?

I've just started reviewing and improving my PHP skills. I'm using Larry Ullman's "PHP and MySQL For Dynamic Websites" as my text, and I downloaded and installed the latest stable builds of Apache, PHP, and MySQL onto my desktop PC.

I've used PHP and MySQL before, in a class I took a year ago, so I remember more or less how it works. But even with the early exercises in the book, I'm hitting a weird problem. The PHP interpreter seems to reach a certain point in the script, and then it simply stops working. Everything after that is converted to an HTML literal and displayed exactly as typed -- even variable names and function calls. Here's an example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<form action="calendar.php" method="post">

$months = array (1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$days = range(1, 31);
$years = range(2005, 2015);
echo "<select name='month'>";
foreach ($months as $key => $value)
echo "<option value=\"$key\"> $value </option> /n";
echo '</select>';
echo '<select name="day">';
foreach ($days as $value)
echo "<option value=\"$value\">$value</option> /n";
echo '</select>';
echo '<select name="year">';
foreach ($years as $value)
echo "<option value=\"$value\"> $value </option> /n";
echo '</select>';

When I open this in Firefox, it seems to work correctly right up to the '=>' in the assignment line for "months." Then it dies as described above, and what I see in my browser looks like this:
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $days = range(1, 31); $years = range(2005, 2015); echo " $value '; echo '$value '; echo ' $value '; ?>
What stupid and obvious thing am I doing wrong?

-- JSW
jwoolf09 is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Caesar's dying breath ktinkel The Corner Pub 1 03-15-2006 07:52 AM

All times are GMT -8. The time now is 07:20 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Contents copyright 2004–2018 Desktop Publishing Forum and its members.