| | |
Dates in drop down box
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2006
Posts: 4
Reputation:
Solved Threads: 0
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
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
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.
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
•
•
Join Date: Dec 2006
Posts: 4
Reputation:
Solved Threads: 0
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
anyways i have to try figure the thing out..i only have 2 weeks left..

thanks
•
•
Join Date: Apr 2009
Posts: 17
Reputation:
Solved Threads: 1
This is a function to make drop down date menus. I hope it's useful for u ;-)
php Syntax (Toggle Plain Text)
function make_date_menus () { //array to store the months $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); print '<select name="month">'; foreach($months as $key => $value) { print "\n<option value=\"$key\">$value</option>"; } print '</select>'; ?> <?php //make the day pull-down menu print '<select name="day">'; for ($day = 1; $day <= 31; $day++) { print "\n<option value=\"$day\">$day</option>"; } print '</select>'; ?> <?php //make the year pull-down menu print '<select name="year">'; $start_year = date('Y'); for ($y=$start_year; $y >=($start_year-60) ; $y--) { print "\n<option value=\"$y\">$y</option>"; $year++; } print '</select>'; } // end of function
![]() |
Similar Threads
- XP not booting - lsass.exe not found (Windows NT / 2000 / XP)
- how to delete extra commas on csv file with php (PHP)
- query a date format within an input box (MS Access and FileMaker Pro)
- I don't want yesterdays Date! (ASP.NET)
- What's the best way to represent dates in a form? (C#)
Other Threads in the PHP Forum
- Previous Thread: Call to undefined function mysql_connect()
- Next Thread: php file append
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





