yeah, i just started scripting php about 4 days ago. I don't normally script in php.
The idea is to create an input text box. (that looks for %letters% in one row of info from the database)
It works, but not seamlessly. Somewhere there seems to be an error in the script and it works only once.
It's supposed to work over and over.
how come my post method text search box works only once?
-testing at mnmotorsports.com/searchtest2.php
--------------- simple version ------------------
<form method="post" action="<?PHP POST_SELF; ?>" id="searchcards">
<input type="text" name="name">
<input type="submit" name="submit" value="search">
</form>
<?php
// connect to host
require("connect.php");
// retrieve data
$name = $_POST['name'];
echo "Names matching: <b>'".$name."'</b>";
$query = "SELECT * FROM ".$tablename." WHERE name LIKE '%$name%' ORDER BY name ASC";
$result = mysql_query($query) or die(mysql_error());
$SearchCntr=0;
while($row = mysql_fetch_array($result)){
$SearchCntr++;
echo "<table border='1'><tr><td><a href='#'>".$row['name']."</td></tr></table>";
}
echo $SearchCntr." SEARCH RESULTS";
?>
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.