I am fetching data from HTML written in my page and below this, I have my PHP code connected to an Oracle
database on the same page. I am unable to check and compare the value rightly.
It's giving always false, I don't know why. I am able to resolve this using my chooseQuery
variable as truthy/false
but I want to know the reason of not working this condition. I think it may be only my server/machine related problem but I want to know the other reason if exists.
HTML Code:
<form action="" method="POST">
<label for="chooseQuery">Choose Query :</label>
<select name="chooseQuery" id="chooseQuery">
<option value="" selected="selected">Choose one of the following to get data</option>
<option value="Direct Approval Mod ID wise">Direct Approval Mod ID wise</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
<label for="start_date">Start Date :</label>
<input type="date" id="start_date" name="start_date" value="<?php echo date('Y-m-d',strtotime('-1 week')); ?>">
<label for="end_date">End Date :</label>
<input type="date" id="end_date" name="end_date" value="<?php echo date('Y-m-d');?>">
<br>
<input type="submit" value="Submit" name="submit">
</form>
PHP Code :
if($con = $config->connectDB('imblrtR')){
if(isset($_POST['submit'])){
$chooseQuery = isset($_REQUEST['chooseQuery']) ? $_REQUEST['chooseQuery'] : '';
$start_date = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : '';
$end_date = isset($_REQUEST['end_date']) ? $_REQUEST['end_date'] : '';
echo "
".$chooseQuery;
if($chooseQuery!=0 && $chooseQuery!='' && $chooseQuery!='0')
{
echo "ok";
//getData($chooseQuery,$start_date,$end_date);
}
else{
echo "Choose Right Option";
}
oci_close($con);
}
}
else
{
echo "not connected
";
}
This is always printing Choose Right Option
even after showing $chooseQuery
value as Direct Approval Mod ID wise
.