I would like to search a mysql database for a list of products that have been inserted between a date range. Say I have a table called product which has: id, name, brand, and datecreated, I can do this in mysql:
select id, name, brand, datecreated
from product
where datecreated between '2013-09-12' and '2013-10-10'
order by datecreated desc;
This will obviously return the desired result either in Mysql or within php.
However I would like to define the date range in the select statement with a form which asks the user for the to and from dates. Not sure what the method will be either ?
<form action="?" method="">
<div id="dates">
<label for="searchdates">Enter your dates here:</label>
<br>
<label for="fromdate">From:<textarea id="fromdate" name="fromdate" rows="1" cols="5"></textarea></label>
<lablel for="todate">To:<textarea id="todate" name="todate" rows="1" cols="5"></textarea></label>
</div>
<div><input type="submit" value="Search"/></div>
</form>
So what I am unsure of is how the user defined date range from the form can be added/inserted to the select statement to return the data within the defined date range?
Cheers Volterony