I have a form in my html page that runs a php page and show the results in real time on an Iframe, the operation is long about 20 minutes, I tried to implement a second button that stops the run killing the process, the php function works but the problem is that if I click the stop button the function doesn't start.Here the HTML:
<div id="allign">
<iframe id="frame" name="my_iframe" height="520" width="1100" allign="right" frameBorder="0" ></iframe>
</div>
<form action="action_calibration.php" method=post target="my_iframe">
<br><br>
<input type="radio" name="type" value="fast" checked>Fast Calibration
<br><br>
<input type="radio" name="type" value="old">Old Calibration
<br><br>
<input type="checkbox" name="ScanVPlus" value="yes" checked>Scan Vcth vs VPlus
<br><br>
<input type="checkbox" name="Bitwise" value="yes">Bitwise Offset Tuning
<br><br>
<input type="checkbox" name="All_channel" value="yes">Calibration using all channel
<br><br>
Output Folder:<input type="textfield" name="output" value="Results/">
<br><br>
Hw Description File:<input type="textfield" name="Hw Description File " value="settings/Calibration2CBC.xml">
<br><br>
<input type="submit" name="exec" value="Submit">
<input type="submit" name="exec1" value="STOP">
<br><br>
</form>
The final part of the action_calibration.php file is like this:
$handle = popen("source ".$command, "r");
$continue=TRUE;
while ((!feof($handle))&& $continue) {
$data = fgets($handle);
print $data."<br/>";
echo $continue;
if(isset($_POST['exec1'])){
$continue=FALSE;
}
}
shell_exec("kill $(pidof calibrate)");
Thank you for your help.
try this ......
<input type="submit" name="exec" value="Submit">
<input type="submit" name="exec1" value="STOP">
$handle = popen("source ".$command, "r");
$continue=TRUE;
while ((!feof($handle))&& $continue) {
$data = fgets($handle);
print $data."<br/>";
echo $continue;
if(isset($_POST['exec1'])){
$continue=FALSE;
}
}
shell_exec("kill $(pidof calibrate)");