Código HTML:
<h3>Fecha Inicio</h3><INPUT type="text" name="date1" size="20" onfocus="doShow('datechooser1','datechooser','date1')" value="<?=$_POST['date1']?>"><br> <div enabled='false' id="datechooser1"></div> <h3>Fecha Final </h3><INPUT type="text" name="date2" size="20" onfocus="doShow('datechooser2','datechooser','date2')" value="<?=$_POST['date2']?>"><br> <div enabled='false' id="datechooser2"></div>
Código PHP:
$date1 = $_POST['date1'];
echo "la fecha es" .$date1;
$date2 = $_POST['date2'];
$query = 'select id_haul, id_catch, shooting_time from "haul" natural inner join catch where a_code = \'$a_code\' and shooting_time between \'$date1\' and \'$date2\'';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());