Forum Moderators: coopster
i have a date in my Database and i explode it, but want to re-concatenate it. I have this working on another page, but wont work on this one although its the same code... have a ganders..
Page1 (where it works)
$day=$_POST['day'];
$month=$_POST['month'];
$year=$_POST['year'];
$fulldate=$_POST['fulldate'];
<td><input type="text" name="day" size="2" value="<?php echo date("d");?>">-
<input type="text" name="month" size="2" value="<?php echo date("m");?>">-
<input type="text" name="year" size="2" value="<?php echo date("y");?>"></td>
</tr>
<?php
//concatanate the inputted values, and format
$fulldate= $year."-".$month."-".$day ;
?>
Page 2 (that doesnt work)
$ardate1=$_POST['ardate1'];
$ardate2=$_POST['ardate2'];
$ardate3=$_POST['ardate3'];
$arriv=$_POST['arriv'];
$dedate1=$_POST['dedate1'];
$dedate2=$_POST['dedate2'];
$dedate3=$_POST['dedate3'];
$depar=$_POST['depar'];
//exploding the arrival date
$startdate = explode("-",$row['arr_date']);
$styear = $startdate[0];
$stmonth = $startdate[1];
$stday = $startdate[2];
//exploding the departure date
$departdate = explode("-",$row['dep_date']);
$deyear = $departdate[0];
$demonth = $departdate[1];
$deday = $departdate[2];
echo('<table frame="border">');
echo('<tr>');
echo('<td>From:</td><td>
<input type="text" name="ardate1" size="2" value="'.$stday.'">-
<input type="text" name="ardate2" size="2" value="'.$stmonth.'">-
<input type="text" name="ardate3" size="2" value="'.$styear.'">');
echo('</td></tr>');
$arriv= $ardate3."-".$ardate2."-".$ardate1;
echo('<tr>');
echo('<td>To:</td><td>
<input type="text" name="dedate1" size="2" value="'.$deday.'">-
<input type="text" name="dedate2" size="2" value="'.$demonth.'">-
<input type="text" name="dedate3" size="2" value="'.$deyear.'">');
echo('</td></tr>');
$depar= $dedate3."-".$dedate2."-".$dedate1 ;
the $stday,$stmonth etc. all appear in the text boxes as requested, but when i try to echo $arriv i get nothing... ok well i get "--"
Its confusing me cos in the 1st example $fulldate echos fine.
any input would be amazing
[1][[b]edited by[/b]: jatar_k at 2:17 pm (utc) on Mar. 5, 2008][/1]
there seems to be some var confusion, are yoiu sure you are using all the right vars in this part?
echo('<td>From:</td><td>
<input type="text" name="ardate1" size="2" value="'.$stday.'">-
<input type="text" name="ardate2" size="2" value="'.$stmonth.'">-
<input type="text" name="ardate3" size="2" value="'.$styear.'">');
echo('</td></tr>');
$arriv= $ardate3."-".$ardate2."-".$ardate1;