
Untitled
By: a guest on
Jun 17th, 2012 | syntax:
None | size: 1.67 KB | hits: 14 | expires: Never
PHP Error: Undefined index: event_list when I think its already defined.
<?php include('functions.php'); ?>
<?php
$yr = $_GET['year_list'];
$evnt = $_GET['event_list'];
?>
<html>
<head>
<script type="text/javascript" src="myscripts.js"></script>
</head>
<body>
<div>
<form name="myform" >
Select Year: <?php echo hspacer(1); ?>
<select id="year_list" name="year_list">
<?php
for($year = (date('Y') - 100); $year <= (date('Y') + 100); $year++ ) {
if ($year == date('Y')) echo "<option value='$year' name='$year' selected='' >" . $year . "</option>";
else echo "<option value='$year' name='$year' >" . $year . "</option>";
}
?>
</select>
<?php echo hspacer(5); ?>
Select Event: <?php echo hspacer(1); ?>
<select id="event_list" name="event_list" >
<?php
$events = array("Karate Tournament", "Beauty Pageant", "Film Festival", "Singing Contest", "Wedding");
foreach($events as $event) echo "<option value='$event' name='$event' >" . $event . "</option>";
?>
</select>
<?php echo vspacer(2); echo hspacer(22); ?>
<input type="submit" id="add_description" name="add_description" value="Add Description" onclick=""/>
</form>
</div>
</body>
</html>
<?php
function hspacer($num_of_spaces) {
$spaces = "";
if ($num_of_spaces > 0) for($i=0; $i<$num_of_spaces; $i++ ) $spaces .= " ";
return $spaces;
}
function vspacer($num_of_linefeeds) {
$linefeeds = "";
if ($num_of_linefeeds > 0) for($i=0; $i<$num_of_linefeeds; $i++ ) $linefeeds .= "<br />";
return $linefeeds;
}
?>
$yr = isset($_GET['year_list']) ? $_GET['year_list'] : null;
$evnt = isset($_GET['event_list']) ? $_GET['event_list'] : null;