Dates in drop down box

Reply

Join Date: Dec 2006
Posts: 4
Reputation: trizzy9 is an unknown quantity at this point 
Solved Threads: 0
trizzy9 trizzy9 is offline Offline
Newbie Poster

Dates in drop down box

 
0
  #1
May 8th, 2009
Hi

i am doing a project for college, and i choose car rental not knowing its trickier as i thought. Im using xampp and oscommerce, and well..PHP. i have almost everything done apart from the calendar where users can choose the dates of when they want to rent the car. i tried few things out in the advanced search in oscommerce and finally got all the days and months and years in drop down box.(3 different boxes). Now the problem is that i can choose the dates but if i click search, it doesnt see that ive choosen the dates.

i was wondering if someone can help me with it. How can i declare the drop down box? right now its: define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

plus theres so many files in oscommerce i have to change so it would be good to get some help about how it has to be declared as...

thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 957
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 126
ardav's Avatar
ardav ardav is offline Offline
Posting Shark

Re: Dates in drop down box

 
0
  #2
May 8th, 2009
Why use 3 dropdowns, when one could do - use a datepicker (loads to choose from). I use Epoch (old free version) in my projects. The search button (I assume it's a submit button for the form holding the date dropdowns) sends the data to a form handler where you pick up the data via POST variables. Correct so far? I assume your database holds date data in UNIX format: yyyy-mm-dd. If you don't concatenate your data (e.g. $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day']) to provide it in the right format for your mysql query, it won't work.
Last edited by ardav; May 8th, 2009 at 5:37 pm. Reason: mistake left out 'dot'
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 4
Reputation: trizzy9 is an unknown quantity at this point 
Solved Threads: 0
trizzy9 trizzy9 is offline Offline
Newbie Poster

Re: Dates in drop down box

 
0
  #3
May 9th, 2009
no well actually its in the default format that came with oscommerce...i think its mm-dd-yyyy...i have to find out what format the database is in...but the things with one drop down box is that would it be suitable for car rental? actually it might be...i just have to enter loads of dates in it...

anyways i have to try figure the thing out..i only have 2 weeks left..

thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 17
Reputation: bluerose is an unknown quantity at this point 
Solved Threads: 1
bluerose bluerose is offline Offline
Newbie Poster

Re: Dates in drop down box

 
0
  #4
May 9th, 2009
This is a function to make drop down date menus. I hope it's useful for u ;-)
  1. function make_date_menus () {
  2. //array to store the months
  3. $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  4. print '<select name="month">';
  5. foreach($months as $key => $value) {
  6. print "\n<option value=\"$key\">$value</option>";
  7. }
  8. print '</select>';
  9. ?> &nbsp; &nbsp; <?php
  10. //make the day pull-down menu
  11. print '<select name="day">';
  12. for ($day = 1; $day <= 31; $day++) {
  13. print "\n<option value=\"$day\">$day</option>";
  14. }
  15. print '</select>';
  16. ?> &nbsp; &nbsp; <?php
  17. //make the year pull-down menu
  18. print '<select name="year">';
  19. $start_year = date('Y');
  20. for ($y=$start_year; $y >=($start_year-60) ; $y--) {
  21. print "\n<option value=\"$y\">$y</option>";
  22. $year++;
  23. }
  24. print '</select>';
  25. } // end of function
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 4
Reputation: trizzy9 is an unknown quantity at this point 
Solved Threads: 0
trizzy9 trizzy9 is offline Offline
Newbie Poster

Re: Dates in drop down box

 
0
  #5
May 11th, 2009
thanks...im not sure yet if it works...it doesnt give any errors but it also doesnt show the box. i have to figure out how to draw the box..hopefully it will work then..
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 4
Reputation: trizzy9 is an unknown quantity at this point 
Solved Threads: 0
trizzy9 trizzy9 is offline Offline
Newbie Poster

Re: Dates in drop down box

 
0
  #6
May 11th, 2009
i should use javascript tho shouldnt i?
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 254
Reputation: BzzBee is an unknown quantity at this point 
Solved Threads: 37
BzzBee BzzBee is offline Offline
Posting Whiz in Training

Re: Dates in drop down box

 
0
  #7
May 11th, 2009
use javascript of it
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC