Solution 1 :

You have to check, the form is submitted or not.

<?php 
if(isset($_POST['submit']))
{
   exec('java -jar "C:temptest.jar" -db dbs.zed.bvba.com -h 10.222.222.22 -new 1', $response);
   print nl2br(print_r($response, true));
}

?> 

Problem :

So when I load my HTML page, it automatically runs the exec() command by default.
How do I make it so like when it only runs when I press the submit button and not my default?

<form action="site.php" method="POST">

  <input type="text" id="fname" name="fname"><br><br> 
  <input type="text" id="lname" name="lname"><br><br> 

  <input type="submit" value="Show values">

</form>

</body>
</html>

<?php

exec('java -jar "C:temptest.jar" -db dbs.zed.bvba.com -h 10.222.222.22 -new 1', $response);
print nl2br(print_r($response, true));

?>

Comments

Comment posted by Calling a particular PHP function on form submit

Does this answer your question?

Comment posted by Ivar

You should be

By