Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Andy Burton #1
Web form dates to MySQL
I am building a admin form (PHP/MySQL), so staff can input Job Vacancy
descriptions into the Website via a Web form that can be displayed on the Web.
I need it to be able for user's to include a Closing date for the application
submission. Obviously I can't use a time-stamp for this function because the
closing dates are always in the future. As MySQL date format is baffling at
the best of times, I cant get the staff to remember MySQL date format. So I
want to create 3 drop down box's with DAY, MONTH & YEAR, but how do I get
3 form elements into 1 MySQL field? I've been looking around the Net for hours
for a solution, but havent come up trumps yet unfortunately. Is there an easy
way of doing this in dreamweaver? or is thing done with Javascript or PHP...
can anyone point me in the right direction plz - thanks If there are any other
solutions other than 3 drop down boxes - plz let me know too :-)
Andy Burton Guest
-
How to you compare dates in a query in Mysql
Dear friends, Plesae help in finding the correct syntax for comparing two dates in a query in MySql database Thank you Subodh Gupta -
MySQL Dates
Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats... -
Searching on Dates in MySQL
Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats... -
Array of Dates from MYSQL?...
This has been puzzelling me for a couple of weeks now, and just can't figure it out. Does anyone know how to return an array of dates from MySQL... -
Selecting a range of dates in MySql
I need to do a search in MySql for birth date range. (i.e. for birth date Any suggestions on how to do this select? Thanks! -
gareth #2
Re: Web form dates to MySQL
If you have three drop down boxes, called day, month, year, just combine
them into one string, and then insert the string into your field in the
database eg
$mysqlDate = $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day'];
Then insert $mysqlDate into your database date field
--
Gareth - TMM Dreamweaver
[url]http://www.dreamweavermxsupport.com/[/url]
[url]http://www.garethdp.com/[/url]
PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.
[url]http://www.phploginsuite.co.uk/[/url]
Co-Author: Dreamweaver MX: Instant Troubleshooter - Apress
Co-Author: Practical Intranet Development - Apress
Co-Author: Dreamweaver MX: Advanced PHP Web Development - Apress
Co-Author: Dreamweaver MX: PHP Web Development - Wrox
gareth Guest
-
Ross Riley #3
Re: Web form dates to MySQL
If you're using php then the three values can be combined. If you call the
select menus day, month and year then after submitting the form you can access
the values as- $_POST['day'], $_POST['month'], $_POST['year'] to combine them
just use.... $date=$_POST['day'].$_POST['month'].$_POST['year']; or more likely
$date=$_POST['year'].$_POST['month'].$_POST['day']; which is the normal order
for a timestamp. There are other ways you can do this. You could ask them to
enter in normal date format(dd/mm/yyyy), but obviously you will need to do some
validation to make sure it's been entered properly. The select menus is
probably the most foolproof method though. If you need any more specific help
then repost.
Ross Riley Guest
-
Andy Burton #4
Re: Web form dates to MySQL
Thanks for your help guys, I have nearly got it to work although there is a
slight problem. The Closing Date field was stil returning 0000.00.00 so I set
up a Test field in MySQL and set it to TEXT, just to see what was being passed
through. After using this php statement $Mysql_ClosingDate =
$_POST['selectYear']. '-'. $_POST['selectMonth']. '-'. $_POST['selectDay'];
and putting in my Form fields: 2005 12 30 (year,month,day) instead of
printing 2005-12-30 to the MySQL field... it was returning a value of 1963...
which I realised 2005 minus 12 minus 30 = 1963 ahhhhhh. What is the correct
statement to use Thanks
Andy Burton Guest
-
Alexandro Colorado #5
Re: Web form dates to MySQL
On Fri, 25 Mar 2005 13:00:03 +0000 (UTC), Andy Burton
<webforumsuser@macromedia.com> wrote:
Hi, date is the best way to go for it, you might also want to know the> Thanks for your help guys, I have nearly got it to work although there
> is a
> slight problem. The Closing Date field was stil returning 0000.00.00 so
> I set
> up a Test field in MySQL and set it to TEXT, just to see what was being
> passed
> through. After using this php statement $Mysql_ClosingDate =
> $_POST['selectYear']. '-'. $_POST['selectMonth']. '-'.
> $_POST['selectDay'];
> and putting in my Form fields: 2005 12 30 (year,month,day) instead of
> printing 2005-12-30 to the MySQL field... it was returning a value of
> 1963...
> which I realised 2005 minus 12 minus 30 = 1963 ahhhhhh. What is the
> correct
> statement to use Thanks
>
different date functions mysql has. This way you would be able to work it
out better:
You got NOW() Timestamp() CURRENT_TIME() and others:
[url]http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html[/url]
--
Alexandro Colorado
------------------------------
Support Engineer
InterAKT Online
[url]http://www.interaktonline.com[/url]
Tel: 40(21) 312.5312
Alexandro Colorado Guest
-
Andy Burton #6
Re: Web form dates to MySQL
Thanks guys... I finally got it to work. I put it in TIMESTAMP order like Ross
& Alex suggested $Mysql_ClosingDate=$_POST['selectYear'].
$_POST['selectMonth']. $_POST['selectDay']; All 3 form fields pass through to
a single MySQL DATE field OK now. Thanks for pointing me in the right
direction.
Andy Burton Guest



Reply With Quote

