I have 2 files: basic.php and pptimeline.php. The first holds the interface the second one is the file that gets the data from database and it is supposed to mimic a json file since I am using this on it: header('Content-Type: application/json');
I have a combo box that displays numbers of process from a database and then displays it in timeline. I managed to pass the $nprocesso
from basic.php to pptimeline.php and print it there. The thing is I want to pass $nprocesso
to pptimeline.php, run the database's queries and then print the data in the basic.php, but I don't know how to do it since the form action leaves me stuck in the pptimeline.php page with the printed text in json format.
I hope I made myself clear.
basic.php
<form action="json/pptimeline.php" method="POST" >
<label for="Process"> NProcess : </label>
<select id="cproc" name="NProc" onchange="document.getElementById('nprocesso').value=this.options[this.selectedIndex].text">
<?php
foreach ($products as $res3)
{
echo "<option value='".$res3["PROCESSO"]."'>".$res3["PROCESSO"]."</option>";
}
?>
</select>
<input type="hidden" name="nprocesso" id="nprocesso" value="" />
<input type="submit" name="search" value="Search"/>
</form>
<?php
if(isset($_POST['search']))
{
$nprocValue = $_POST['Proc'];
$nproc = $_POST['nprocesso']; // get the selected text
}
?>
pptimeline.php
if (isset ($_REQUEST['nprocesso'])) {
$nprocesso = $_REQUEST['nprocesso'];
echo $nprocesso;
}