I have an HTML5 form that takes in the date which is then submit to my MySQL via PHP. On my display results page I show the date, as well as the Weekday using DATE_FORMAT. Everything works fine when displaying date and weekday. I also have a search feature that looks through the database for the terms entered.
The problem is, the weekday isn’t stored in the database. Only the date is stored. So if a user searches for “Monday” nothing will show up. I can’t really figure out how to insert weekday into my INSERT statement either since I don’t actually have a field in my HTML5 form for weekday.
If you understand my predicament, can you assist me? I basically need to insert the current weekday into it’s own column in my table WITHOUT having the user doing any extra work.
I can provide code samples if necessary.
You could create a hidden field with that information in it:
Then when it gets submitted, it will be saved without the user having to do anything.
You can get the weekday from your original date string by using php strtotime and date functions.