i don’t know why you want to use query strings and get requests in place of a form post. i can’t help with that because i only use post methods. i think it is valid to use select without a form tag but simply why? i dont get it. i would prefer to use a post and validate the data while restricting it to numbers of four digits. anyway…
where are you storing your database connection details? i see a constant in a class file with data that isn’t useful for connecting to a database.
public const DB_SERVER = 'DB_HOST';
public const DB_USERNAME = 'DB_USERNAME';
public const DB_PASSWORD = 'DB_PASSWORD';
public const DB_DATABASE_NAME = 'DB_NAME';
public const DB_PORT = '3306';
where do you pass the actual username and password, for example?
Here is the original script as written which i purchased. It would not work on newer php versions. So i had it upgraded here. However it did not work like this older version which ran on php 5.6 anyway here it is. https://xgarage.org/
Also here is this new connection.php in the specific area you inquired about.
public const DB_SERVER = 'localhost';
public const DB_USERNAME = 'xgarage_jk(osFN*';
public const DB_PASSWORD = 'usk8w038hsf';
public const DB_DATABASE_NAME = 'xgarage_kL*Vh6(';
public const DB_PORT = '3306';
This is the only config above needed to make it work. Also those certainly are not the correct login details to my database.
Also here is the thread where i requested help. I have no idea how to properly code any of this. So i have started this new thread to get my project back on track. It’s unimportant to me who upgraded this script. I just know it still needs some work because it’s certainly not correct so to speak.
well i will look at the new zip after i eat my dinner. i am in Berlin and it is after six pm here.
anyway, i am often very busy. too busy to even tweak someones code but a simple post script is easy enough. i can help you out with a better form process when i get some free time.
nice to know that you have the common sense to not post your real db password. you would be surprised at people that do this sort of thing. so very good.
again, i can help you with a simple form and form processing script when i have free time. maybe even later today. i will have to see. otherwise, sometime soon.
Yea i posted that i wanted it to be PDO. However this is what i got back from the dev here. So there’s that. Btw i don’t expect anything for free. I really appreciate all of the dev’s here and the most important thing is their time.
well i will help you with a script to replace this stuff but i prefer that you donate ten bucks or so to a charity or donate blood to a blood drive or something thoughtful. i’m not interested in petty cash for a simple script. i certainly don’t want to take away from anyone here that needs the money. if someone wants to freelance then speak now or keep your peace.
You would need to be more specific about what ‘will not work’ and ‘fiddle with it’ means.
You would need to detect if the request was via an ajax request and only run the .php code if it is. The following line produces a defined constant that can be tested anywhere in the rest of the php code on the page -
// determine if the request was an ajax request
define('IS_AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
// the following code is only ran if there's an ajax request
To submit the selected values using a form, you would add a form, with a submit button, around the three select menus.
If you want to use the selected values on the current page, you would reference them using the three jquery statements you posted.
Note: The code you have is not how this process is normally done. It has a hard-coded list of years, when you select a year it returns ALL the make and model data for that year to the browser, finds the unique make information for the make menu, triggers a change event for the make menu to populate the model menu, which leaves you with the first make/mode information pre-selected.
How this is normally done is - query to get a list of the unique years that exist in the data and use this to produce the year menu. When a year is selected, get a unique list of makes for that year. When a make is selected, get the models for that year and make.
Okay if you load the site with no cache. You need to select a YEAR to get started. However on my end i need to select a YEAR multiple times in order to get any MAKE to load. Once the MAKE does load it seems to work fine from then on out.
So i guess you can say once the cache is loaded properly in my chrome browser the script will work. However if i dump the cache and try it again. I have to load different YEARS multiple times again to get the MAKE to work.
Here is my point though i don’t want select boxes. I want the first step to load with the years like this so mobile user don’t have such a hard time.
If the year you are initially selecting is 2010 (which is what I picked too), there’s no data in your database that matches that year. If it is the first year you pick, you don’t get any choices for the next two select menus. If you pick some other year first, that does have data, then pick 2010, you get the choices from whatever year you picked before. The code isn’t correctly dealing with empty data.
I also notice that the hollander parts site displays make information (Fiat for example) for which no model information exists in a year. You would want to avoid this so as to not cause visitors to waste time clicking on links that don’t have any data. You would either not display the make at all or display it as a non-link.