Search form issue | WordPress.org

I have a simple form which will be later developed into searching a database, but I cannot figure out why this form doesn’t work in Neve. I put the following under a copy of single.php in Neve folder.

<?php
if(isset($_POST[‘submitsearch’])){
$searchkey = $_POST[‘searchwork’];
echo $searchkey;
}
?>
<body>

<form action=”search_works.php” method=”POST”>
<input type=”text” name=”searchwork” placeholder=”Search for pieces”>
<input type=”submit” name=”submitsearch” value=”Find”>
</form>

Above search_works.php is the template I made to insert this code and use on the “/search” page, which is visible to the user (atm, the web page is not public).

Instead of echoing the search term the user submits, it redirects to the default search and searches for “search_works.php” which is the form action. I’d be thankful if anyone could give me an idea of what might be going on here.

  • This topic was modified 11 hours, 33 minutes ago by yasasa.
  • This topic was modified 11 hours, 18 minutes ago by yasasa.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here