Jump to content

phpnewbie34

Members
  • Posts

    4
  • Joined

  • Last visited

phpnewbie34's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My php page is Pagination style with a few pages Is a possible to add a search bar to pagination website? How do I carry the search term over in the address bar w/ pagination?
  2. Hello friends. I am have a search bar that displays results from my DB How do I refresh the page (e.i, index.php) and add the info to a search bar when the user clicks SUBMIT note: I do not want another page - Just one, THANKS
  3. I am not getting any error messages. I am wondering how I can alter the database live using search as well as making it work with a pagination script. What is wrong with my SELECT by statement?
  4. Good afternoon, I am looking to add a live search to my site. My JS / HTML code is: <script> var form = document.getElementById('keywordForm'); form.addEventListener('submit',function(e) { var search = form.keyword.value; var xhr = new XMLHttpRequest(); xhr.open("GET","keywordsearch.php?search="+search,true); xhr.send(); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { var response = xhr.response; } }; e.preventDefault(); }); </script> <form id="keywordForm"> <input id="keyword" type="text" /> <input type="submit" value="Search"/> </form> And my PHP for the other page is: <?php if(isset($_GET['search'])) { $search = $_GET['search']; include 'dbconnect.php'; //Include code that connects to the database $result = mysqli_query($con, "Select * FROM pixs WHERE search=$search" ); $keywords = array(); while ($keywords = mysqli_fetch_array($result)) { $keywords[] = $keyword['keyword']; } echo json_encode($keywords); } ?> I can't even get it to refresh on the first when I click on the search button. Any advice / tips / examples would be amazing!
×
×
  • 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.