0

Please help on the multiple textbox as date in mysql

<input type="text" name="date" class="f_input input1" style="width:32px;" value="D" maxlength="1" onBlur="if(this.value=='') this.value='D'" onFocus="if(this.value =='D' ) this.value=''"  >
<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="D" onBlur="if(this.value=='') this.value='D'" onFocus="if(this.value =='D' ) this.value=''"   >

<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="M" onBlur="if(this.value=='') this.value='M'" onFocus="if(this.value =='M' ) this.value=''"  >
<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="M" onBlur="if(this.value=='') this.value='M'" onFocus="if(this.value =='M' ) this.value=''">

<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1"  value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="date" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">

how to store this in database as (dd/mm/yyyy) format

2
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

I think this is not good way of entering date
check jqueryui datepicker its very simple to use, in your case how you will validate date

any way for your case
you must give name and ids to all elements like

<input ....  name='d1' id='d1' >
<input ....  name='d2' id='d2' >
<input ....  name='m1' id='m1' >
<input ....  name='m2' id='m2' >
<input ....  name='y1' id='y1' >
<input ....  name='y2' id='y2' >
<input ....  name='y3' id='y3' >
<input ....  name='y4' id='y4' >

when it is submitted to php process page it must build date there

<?php
$dateval=$_POST['y1'].$_POST['y2'].$_POST['y3'].$_POST['y4']."-".$_POST['m1'].$_POST['m2']."-".$_POST['d1'].$_POST['d2']

$insertquery="insert into table (mydate) values ($dateval)";

?>

Edited by urtrivedi: n/a

0

I think this is not good way of entering date
check jqueryui datepicker its very simple to use, in your case how you will validate date

any way for your case
you must give name and ids to all elements like

<input ....  name='d1' id='d1' >
<input ....  name='d2' id='d2' >
<input ....  name='m1' id='m1' >
<input ....  name='m2' id='m2' >
<input ....  name='y1' id='y1' >
<input ....  name='y2' id='y2' >
<input ....  name='y3' id='y3' >
<input ....  name='y4' id='y4' >

when it is submitted to php process page it must build date there

<?php
$dateval=$_POST['y1'].$_POST['y2'].$_POST['y3'].$_POST['y4']."-".$_POST['m1'].$_POST['m2']."-".$_POST['d1'].$_POST['d2']

$insertquery="insert into table (mydate) values ($dateval)";

?>

in this only last four character itself inserting I mean only 'yyyy'

0

I could not insert partial date if you mysql datatype is date.

Post your code what you have done so far after my suggestion.

Edited by urtrivedi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.