iggy407 Posted March 9, 2011 Share Posted March 9, 2011 I have a textbox which i want users to be able to search the database for zipcodes, I can't seem to make it work my IDE doesn't show any errors but when I test the code everything goes blank, the mysql credentials are all correct the code is, any suggestions would help <form action="index.php" method="post"> <label for="search2" style="color:#FFF;background-color:#0A016D"><b>Search Homes by Zipcode</b></label><br> zipcode: <input type="text" name="zipcode"><br> <button type="submit" name="submit" value="submit"/> </form> <?php $zipcode= @$_post['zipcode']; require("myconn.php"); mysql_select_db("phplogin")or die(mysql_error()); $sql= mysql_query("SELECT * FROM users WHERE zipcode='$zipcode' "); $numrow= mysql_num_rows($sql); while($row= mysql_fetch_assoc($sql)) { echo "zipcode: ".$row['zipcode']." city :".$row['city']."<br/>"; } ?> Link to comment https://forums.phpfreaks.com/topic/230121-trouble-connecting-search-textbox-to-database/ Share on other sites More sharing options...
Pikachu2000 Posted March 9, 2011 Share Posted March 9, 2011 1) Remove the @ error suppression character from your code. That character, with limited exception has no place in code except when it's part of an email address. 2) There is no such variable as $_post, unless you've defined it yourself, but the error suppression is hiding the warning that would be generated. $_POST != $_post Link to comment https://forums.phpfreaks.com/topic/230121-trouble-connecting-search-textbox-to-database/#findComment-1185111 Share on other sites More sharing options...
iggy407 Posted March 9, 2011 Author Share Posted March 9, 2011 ok thank you.. the $_POST was what i needed, just fixed the problem Link to comment https://forums.phpfreaks.com/topic/230121-trouble-connecting-search-textbox-to-database/#findComment-1185113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.