Hello,
Can anyone help me with this script I'm using?
I've saved dates in a database and want to make two select-lists of these
dates in a html-form.
I want to select each unique date one time (no doubles).
List 1 is used to set the begin-date of the query for the report, List 2
will
set the end-date and must be reversed.
When the form is processed the data selected between the begin-date and the
end-date has to be show.
I can't seem to get my code to work: the select-lists stay empty after
processing the code below.
Can anyone help? Tips...
regards,
Bart
<<< BEGIN:PHP-CODE >>>
$i=0;
$result = mysql_query ("SELECT DISTINCT date FROM linktracker WHERE name
LIKE '$PHP_AUTH_USER' ORDER BY date");
if ($row = mysql_fetch_array($result)) {
do {
$date = array(
"begin" => array($i => $row["date"]),
"end" => array($i => $row["date"])
);
$i++;
} while ($row = mysql_fetch_array($result));
} else {print ("Sorry, no record were found.");
} //end else $result
print("<table><tr><td>Begindate</td<td>Enddate</td></tr>\n".
"<tr><td><form method=\"post\" action=\"index.php\"
name=\"date_select\">".
"<input type=\"hidden\" name=\"action\"
value=\"date_select\">".
"<select name=\"date_begin\">");
while (list($key, $date_begin) = each($date[begin])) {
echo "<option value=\"".$date_begin ."\">" . $date_begin .
"</option>\n";
}
print("</select></td><td><select name=\"date_end\">");
rsort($date[end]);
while (list($key, $date_end) = each($date[end])) {
echo "<option value=\"".$date_end ."\">" . $date_end .
"</option>\n";
}
print("</select></td></tr>\n<tr><td colspan=\"2\">".
"<input type=\"submit\" name=\"Submit\" value=\"Submit\">".
"</form></td></tr</table>");
mysql_free_result ($result);
mysql_close();
<<< END:PHP-CODE >>>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]