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

Recommended Answers

All 6 Replies

Member Avatar for diafol

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 . "-" . $_POST . "-" . $_POST) to provide it in the right format for your mysql query, it won't work.

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

This is a function to make drop down date menus. I hope it's useful for u ;-)

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>';
	?> &nbsp; &nbsp; <?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>';
	?> &nbsp; &nbsp; <?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

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..:)

i should use javascript tho shouldnt i?

use javascript of it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.