View Single Post
 
Old February 1st, 2005, 01:09 AM
ismnanie ismnanie is offline
Registered User
 
Join Date: Jan 2005
Location: klang, selangor, Malaysia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ismnanie Send a message via Yahoo to ismnanie
Default

I've tried $_POST method for one of the functions and it works on the next page!thank you.
However, i still have problem to pass the date.

On a.php:

//1st date
<SELECT name="MoSel" onchange="MonLen(YrSel, MoSel, DySel)"> </SELECT>
  -
<SELECT name="DySel"> </SELECT>
  -&nbsp;
<select name="YrSel" onChange="MonLen(YrSel, MoSel, DySel)"> </select>

<script language="JavaScript">
document.write(DropReadYMD(YrSel, MoSel, DySel));
</script>


//2nd date
<SELECT name="Mos" onchange="MonLen(Yrs, Mos, Dys)" >
</SELECT>
   -
<SELECT name="Dys"></SELECT>
   -&nbsp;
<select name="Yrs" onChange="MonLen(Yrs, Mos, Dys)" >
</select>

<script language="JavaScript">
document.write(DropReadYMDn(Yrs, Mos, Dys));
</script>


<script language = "Javascript">

function DropReadYMD(Yr, Mo, Dy) {
  var Y = + Yr.options[Yr.selectedIndex].text
  var M = Mo.selectedIndex // 0..11
  var D = Dy.selectedIndex + 1
  return Y + '-' + Lz(M+1) + '-' + Lz(D); }

function X()
{
  with (document.forms['form1']) { return DropReadYMD(Yr, Mo, Dy) }
}

function Y()
{
   with (document.forms['form1']) { return DropReadYMDn(Yr, Mo, Dy) }
}
</script>
//both of the functions will give yyyy-mm-dd format


By using hidden fields on the same form to send the values;
<input type="hidden" name="date1" readonly="X();">
<input type="hidden" name="date2" readonly="Y();">

---
On b.php

$dt1 = $_Post['date1'];
$dt2 = $_Post['date2'];
$query="SELECT * FROM tbl WHERE Date >= '$dt1' and
       Date <= '$dt2';
//Date in yyyy-mm-dd format

--

I want to retrieve the information between date1 and date2 but nothing works =(. Does anyone has an idea to solve the problem?