Forum Moderators: coopster
My form and query:
$query = "SELECT id, DATE_FORMAT(date, '%M %d, %Y') AS d FROM reports WHERE YEAR(date) = '2005' ORDER BY id DESC";
$result = mysql_query ($query);
echo "<form method=\"GET\" action=\"./view.html\">
<span class=\"a2\"><b>2005:</b></span>
<select name=\"report\" class=\"select\">";
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo "<option value=\"$row[id]\">$row[d]</option>";
}
echo '</select>
<input type="submit" value="GO">
</form>';
This query limits the selections from the table to 2005. I have separate form for 2004.
I have tried changing the method to POST but can't get the date to pass on where I'd like to set up a rewrite rule to write the url as "/$d/" or "/2005-06-25/".
I can rewrite the url fine with a text link just not with the form and to keep the page as compact as possible have had to live with the GET method and the url with a query string.
Thanks for any suggestions someone might have.
To clarify - I want to send the date of the report to the "view.html" page using POST as the form method so I can rewrite the url using a RewriteRule like:
RewriteRule ^([^.]+)$ view.php?d=$1 [L]
where "d" is the date of the report that is selected by the sql query.
I currently use GET method and it sends the id or date to the view.php page but the url displays with the query string.
Am just having trouble getting the POST method to pass the date variable.