I am trying to get a searched date from one page to appear on another page, i have this code on one page so the user can search for a specific date:
<?php
if(!empty($_POST['searchdate'])) {
$mydate = $_POST['searchdate'];
} else {
$mydate = date('Y-m-d');
}
$id = $_POST['id'];
if(empty($id) && !empty($_POST['ConveyorNumber'])) {
$id = $_POST['ConveyorNumber'];
}
$Date=date ("Y-m-d H:i");
?>
<form action="baa_history3.php" method="post" name="history" id="history">
<div class="menu_date_history">
<input name="searchdate" type="text" id="searchdate" value="<?php echo $mydate; ?>" size="30"/>
<input name="date_history" type="submit" id="date_history" value="Search" size="30" />
<input name="id" type="hidden" value="<?php echo $id; ?>" /></div>
</form>
It appears fine on baa_history3.php, but then there is a button on this page to go to another form which i want to display this same date that was searched.
I have this code:
<?php
if($_POST["orderby"] == "ConveyorNumber"){
$orderby = "cn.ConveyorNumber";
} else {
$orderby = "`Date`";
}
$location=$_POST['location'];
if(!empty($_SESSION["Shift"]))$Shift = $_SESSION["Shift"];
if(!empty($_SESSION["Site"]))$Site = $_SESSION["Site"];
$thisdate = $_POST['thisdate'];
// print_r($_POST);
$start = $_POST['start'];
if(empty($start) or $start < 0) $start =0;
if(!empty($_POST['searchdate'])) {
$mydate = $_POST['searchdate'];
$query_Asset = "SELECT c.*,cn.*,c.BAA_Shift, c.BagReference,c.Asset_ID, c.AssetType FROM t5_week3_shift3 as c join conveyor_number as cn on c.Asset_ID = cn.ConveyorNumber WHERE c.`Shift` = '$Shift' and c.Site='$Site' and date(cn.`Date`)='$mydate' and cn.Location = '$location' order by $orderby";
} else {
$query_Asset = "SELECT c.*,cn.*,c.BAA_Shift, c.BagReference,c.Asset_ID, c.AssetType FROM t5_week3_shift3 as c join conveyor_number as cn on c.Asset_ID = cn.ConveyorNumber WHERE c.`Shift` = '$Shift' and c.Site='$Site' and cn.Location = '$location' order by $orderby";
}
$Asset = mysql_query($query_Asset, $Database_Connection) or die(mysql_error());
?>
<td colspan="9">SHIFT:<?php echo $Site . ' - ' .$Shift ; ?></td>
<input name="searchdate" type="hidden" id="searchdate" value="<?php echo $mydate; ?>" size="30"/>
<?php echo $mydate; ?>
The shift and site display fine, but the searched date doesnt, it is because the shift and site are using session?