PHP Reading in a text file using explode() to get specific parts of text

PHP Reading in a text file using explode() to get specific parts of text

So i have two text files, one called users.txt and schedule.txt. The
schedule.txt looks like this:
2013-04-11^12:00|4:00|14:00
2013-07-21^10:00|15:00|18:00|15:00
2013-12-11^13:00|14:00
and the users.txt file looks like this:
John Smith^2|4|6
Star Wars^0|1|3|6
Luke Skywalker^2|6|7|8
and each of those numbers corresponds to the index of the other file...so
for example John Smith has a time 14:00 on 2013-04-11 (from the 2), a time
of 15:00 (from the 4) and so forth...
Well Im building a table for all of this using HTML and I am having
trouble extracting the values for the time (ex 12:00).
Also I am very NEW to html and PHP so please go easy on me...please if you
have pointers or any other useful information please share =) I will
definitly be needing it when I try to add an edit (for editing times to
this using radio buttons) and adding a new user.
Thank You so much for any help/advice!
Here is my code:
<?php
<!DOCTYPE html>
<html>
<head>
<title>Scheduler</title>
</head>
<body>
<h2>
<center>Select Your Meeting Times</center></h2>
<table border="1"
cellpadding="10">
<tr>
<th>User</th>
<th>Action</th>
<?php
//error_reporting(0);
date_default_timezone_set('America/New_York');
// used for displaying schedule times
$schedule= file('schedule.txt');
// loop through array and output contents
foreach($schedule as $s) {
list($year, $month, $day) = explode('-', $s);
$ga = explode("|", $s);
var_dump($year);
//echo $ga[5];
$year= intval($year, 10);
$month= intval($month, 10);
$day= intval($day, 10);
$h = mktime(0, 0, 0, $month, $day,$year);
$d = date("F dS, Y", $h); //used to get the day of the week
$w= date("l", $h); // w now holds the day of the week.
foreach($schedule as $t)
{
// $split = preg_split('/| /', $t, -1, PREG_SPLIT_NO_EMPTY);
list($time) = explode("|", $t);
list($time1) = explode(" ", $time);
// var_dump($time1);
// $output = trim($time1);
// echo $test;
echo "<th>" . $w . "<br>" . $month . "/" . $day . "/" .
$year . "</th>\n";
}
}
?>
</tr>
<tr>
<?php
$text = file('user.txt');
// loop through array and output contents
foreach($text as $user) {
list($u) = explode('^', $user);
echo "<tr>" . "<td>" . $u . "</td>" . "</tr>\n";
}
?>
</tr>
<tr>
<th><br></th>
</tr>
<tr>
<th>Total</th>
</tr>
</table>
</body>
</html>