I am trying to embed an expert system in a site.
My code for expert system is a Jess script (1.clp) like :
(defrule ask_input
(initial-fact)
=>
(printout t "Welcome " ?*answer* crlf)
)
I use a form in php and I would like when I press submit button to run 1.clp via jess with variable fname from the form to be saved in ?answer.
For example 1.html
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
<input type="submit" />
</form>
</body>
</html>
welcome.php
<?php
$name = $_POST["fname"];
// connect with 1.clp
?>
Any ideas ?
Can I do the same somehow else ?? Thanks in advance
This would be so much easier in Java; Jess is just a Java library you can embed in a servlet or JSP. From PHP, you have to somehow bridge between the two runtimes, and although doubtless someone's done it at some point, it would be an unholy Frankensteinian thing that made grown men weep like babies.