ok I am sure this is a simple problem and some one will help me.
This is piece of my kode :
/*this is line number 15*/ $months = array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
when I preview in my browser an error shows up : Parse error: parse error in c:\calendar.php on line 15
Problem is that code is right what could be a cause ?
Problem with arrays
Moderator: General Moderators
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Problem with arrays
Paste more code
Re: Problem with arrays
<!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”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1” />
<title>Nauka PHP</title>
</head>
<body>
<form action=”calendar.php” method=”post”>
<?php # Script 2.6 - calendar.php
// This script makes three pull-down
menus
// for an HTML form: months, days, years
// Make the months array:
$months = array (1 => 'January',
'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September',
'October', 'November', 'December');
// Make the days and years arrays:
$days = range (1, 31);
$years = range (2008, 2018);
// Make the months pull-down menu:
echo '<select name=”month”>';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value
</option>\n";
}
echo '</select>';
// Make the days pull-down menu:
echo '<select name="day">';
foreach ($days as $value) {
echo "<option value=\"$value\">$value
</option>\n";
}
echo '</select>';
// Make the years pull-down menu:
echo '<select name="year">';
foreach ($years as $value) {
echo "<option value=\"$value\">$value
</option>\n";
}
echo '</select>';
?>
</form>
</body>
</html>
<html xmlns=”http://www.w3.org/1999/ xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1” />
<title>Nauka PHP</title>
</head>
<body>
<form action=”calendar.php” method=”post”>
<?php # Script 2.6 - calendar.php
// This script makes three pull-down
menus
// for an HTML form: months, days, years
// Make the months array:
$months = array (1 => 'January',
'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September',
'October', 'November', 'December');
// Make the days and years arrays:
$days = range (1, 31);
$years = range (2008, 2018);
// Make the months pull-down menu:
echo '<select name=”month”>';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value
</option>\n";
}
echo '</select>';
// Make the days pull-down menu:
echo '<select name="day">';
foreach ($days as $value) {
echo "<option value=\"$value\">$value
</option>\n";
}
echo '</select>';
// Make the years pull-down menu:
echo '<select name="year">';
foreach ($years as $value) {
echo "<option value=\"$value\">$value
</option>\n";
}
echo '</select>';
?>
</form>
</body>
</html>
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Problem with arrays
Code: Select all
<?php
// This script makes three pull-down
menus # <--- comment this
// for an HTML form: months, days, years
// Make the months array:
$months = array (1 => 'January',
'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September',
'October', 'November', 'December');?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Problem with arrays
hah thanks mate thats it :]