Jump to content

monger

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by monger

  1. 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.
  2. 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"; ?>
  3. for some reason, post doesnt run correctly the second time around..
  4. ------ index.php ------- <?php require("head.php");?> <table width="800" border="1"><tr><td width="550"></td><td> <form method="post" action="<?PHP POST_SELF; ?>" id="searchcards"> <input type="text" name="name"> <input type="submit" name="submit" value="search"> </form> </td></tr> <tr><td height ="300"><?php require("search.php"); ?></td><td></td> </tr> </table> <?php require("footer.php"); ?> -------- search.php ---------- <?php if ($_POST['submit']=="search"){ // connect to host require("connect.php"); // retrieve data $name = $_POST['name']; echo "Searching any card name matching: <b>'".$name."'</b>"; $query = "SELECT * FROM ".$tname." WHERE name LIKE '%".$name."%'"; $result = mysql_query($query) or die(mysql_error()); $SearchCntr=0; while($row = mysql_fetch_array($result)){ $SearchCntr++; echo "<table border='1' width='500'>"; echo "<tr><td>".$row['edition']." | <a href='#'>".$row['name']."</a> | ".$row['manacost']." | ".$row['price']."</td></tr>"; echo "</table>"; } echo $SearchCntr." SEARCH RESULTS</body></html>"; }else{ echo "Search failed"; } ?>
  5. //here is the code. For some reason it searches the first time, but the second search loads everything. testing at: mnmotorsports.com // searcha.php <?php require("head.php");?> <table width="800" border="1"><tr><td width="550"></td><td> <form method="post" action="searcha.php?go" id="searchform"> <input type="text" name="name"> <input type="submit" name="submit" value="Search"> </form> </td></tr> <tr><td height ="300"> <?php echo "searching"; // connect to host require("connect.php"); // retrieve data $name = $_POST['name']; echo " any card name matching: <b>'".$name."'</b>"; $query = "SELECT * FROM ".$tname." WHERE name LIKE '%".$name."%'"; $result = mysql_query($query) or die(mysql_error()); $SearchCntr=0; while($row = mysql_fetch_array($result)){ $SearchCntr++; echo "<table border='1' width='500'>"; echo "<tr><td>".$row['edition']." | <a href='#'>".$row['name']."</a> | ".$row['manacost']." | ".$row['price']."</td></tr>"; echo "</table>"; } echo $SearchCntr." SEARCH RESULTS</body></html>"; ?> </td><td></td> </tr> </table> <?php require("footer.php"); ?>
×
×
  • Create New...

Important Information

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.