chrispos Posted October 20, 2011 Share Posted October 20, 2011 I have a page with 3 drop down lists one for day of the month, one for month and one for year. what I am trying to do is use something that will enable me to make each day from the selected dates to appear as individual days. So if someone selected 1st of September and then 23rd of September it would show 1 2 3 4 5 up to 23. I need to be able to put this in a database. The make date is easy and I think I need to use explode but when I have seen this it comes out with 1, 2, 3, 4, and I do not want to use the comer. This is what I am using for the dates. <?php $d = $_POST['d']; $m = $_POST['m']; $y = $_POST['y']; $d1 = $_POST['d1']; $m1 = $_POST['m1']; $y1 = $_POST['y1']; $date = date ("M-d-Y", mktime(0, 0, 0, $m, $d, $y)); $date1 = date ("M-d-Y", mktime(0, 0, 0, $m1, $d1, $y1)); ?> It will also have prices with these dates so if the user puts in 20.00 for day 1 it would need to go in for the dates selected. ie 1st 20.00 2nd 20.00 and so on. Any ideas or help would be appreciated Many Thanks Quote Link to comment https://forums.phpfreaks.com/topic/249470-how-to-make-a-list-from-2-dates/ Share on other sites More sharing options...
chrispos Posted October 20, 2011 Author Share Posted October 20, 2011 I have solved this using a loop the code is below if anyone needs it. <?php $d = $_POST['d']; $d1 = $_POST['d1']; $num = $d; while ($num <= $d1) { echo $num."<br />"; $num++; } ?> Many thanks for looking Quote Link to comment https://forums.phpfreaks.com/topic/249470-how-to-make-a-list-from-2-dates/#findComment-1280889 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.