For some reason my code won’t recognize the index that is getting passed over a URL.
On page 1 the code says
<?php
$xml = simplexml_load_file('events.xml');
$day=array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7);
?>
Then when you click the link to the new page the url is “events.html?day=0”
On the second page the code is
<?php
$xml = simplexml_load_file('events.xml');
$day=array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7);
$dayvalue=$_GET['day'];
$event = $xml->event[$dayvalue];
echo $dayvalue. '<br />';
$name = $event->name;
$location = $event->location;
$time = $event->time;
echo 'Name: ' .$name. '<br />';
echo 'Location: ' .$location. '<br />';
echo 'Time: ' .$time. '<br />';
?>
The problem comes at $event = $xml->event[$dayvalue];
If I replace $dayvalue with 0 it works. I have echo $dayvalue and it outputs 0.
Why won’t this work?