Here is my code where i am trying to send back the values in the from and to field to the same page. At the top of the page i have this code: (it always echos 'in else loop', i dont understand what is wrong with this simple thing.)
if ($_POST['ok'])
{
if (isset($_GET['from']))
{
$tmp_fromdate=$_GET['from'];
$tmp_todate=$_GET['to'];
echo "in if loop<br/>";
echo $tmp_fromdate. " ". $tmp_todate."<br/>";
$from_date=date("Y-m-d", strtotime($tmp_fromdate));
$to_date=date("Y-m-d", strtotime($tmp_todate));
echo $from_date. " ". $to_date."<br/>";
$fdate=date("F d Y", strtotime($tmp_fromdate));
$tdate=date("F d Y", strtotime($tmptodate));
}
else
{
echo "in else loop<br/>";
$start_date='2010-08-01';
$end_date=date ("Y-m-d");
$sdate=date("F d Y", strtotime($start_date));
$edate=date("F d Y", strtotime($end_date));
}
}
<form id="form1" name="form1" method="post">
<div class="demo">
<label for="from">From</label>
<span id="sprytextfield1">
<input type="text" id="from" name="from" />
<span class="textfieldRequiredMsg">mm/dd/yyyy format only.</span>
</span>
<label for="to">to</label>
<span id="sprytextfield2">
<input type="text" id="to" name="to" />
<span class="textfieldRequiredMsg">mm/dd/yyyy format only.</span>
</span>
<input type="submit" id="ok" name= "ok" value="Change Dates"/>
<input type="hidden" name="from" VALUE="<? echo($from);?>"/>
<input type="hidden" name="to" VALUE="<? echo($to);?>"/>
</div>
</form>