Now we need to create the PHP script that will channel communication between our Python program and the web page. The basic code is below.
We will discuss this script on the next page. If you would like to keep the code to hand for reference, copy it into your favorite editor or open this page in a new window.
<?php
$results = shell_exec ("./search \"" . $_POST["word"] . "\" 3") ;
print "
<html>
<head>
<title> About.com's Python Program Results.</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./myway.css\" />
</head>
<body>
<div class=\"search\">
<form action=\"search.php\" method=\"post\">
<h5>Search <br>
<input type=\"text\" name=\"word\" size=\"20\" onChange=\"submit(word)\"><br>
<!-- <input type=\"submit\" value=\"Submit\" /> </h5> -->
</form>
</div>
<h1 class=\"welcome\"> Welcome to Python with PHP and Javascript </h1>
<h6 class=\"maintext\"> ";
print $results;
print "</h6> </body> </html>";
?>
