Hello, I dont know jquery. I am trying edit some code from web for autocomplete. Is it possible retrieve value afer submit from php page? What's way ? Or only with js ? Connection is ok, selecting too. Link to other page is created with paramaters. Thanks.
-- test.php --
<?php
session_start();
ob_start();
require_once "config.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>jQuery Autocomplete Plugin</title>
<script type="text/javascript" src="jquery.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript">
$().ready(function() {
$("#course").autocomplete("get_course_list.php", {
width: 260,
matchContains: true,
//mustMatch: true,
//minChars: 0,
//multiple: true,
//highlight: false,
//multipleSeparator: ",",
selectFirst: false
});
});
</script>
</head>
<body>
<h2 id="banner">Ajax Autocomplete Demo
- Jquery, PHP, Mysql</h1>
<div id="content">
<form autocomplete="off">
<p>
Course Name <label>:</label>
<input type="text" name="course" id="course" />
<!--input type="button" value="Get Value" /-->
</p>
<input type="submit" value="Submit" />
</form>
</div>
<div align="center">
<a href="http://beski.wordpress.com">http://beski.wordpress.com</a>
</div>
</body>
</html>
-- get_course_list.php --
<?php
require_once "config.php";
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "select DISTINCT course_name as course_name from course where course_name LIKE '%$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$cname = $rs['course_name'];
echo "$cname\n";
}
?>