Custom Part Search Box just disappeared
-
Hi there!
I am trying to figure out why my search box just disappeared in the last 2 months. It was working like a charm for over 2 years, but now it has vanished.
My searchform.php file looks like this:
<form role="search" method="post" class="searchform" action="https://www.calportaviation.com/search-results/"> <div><label class="screen-reader-text" for="term">Search for:</label> <input type="search" value="" placeholder="Part Number or NSN" name="term" id="term" /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form>
And my search-results.php file looks like this:
<?php /* Template Name: Search Results */ get_header(); ?> <section id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php global $wpdb; $PartNum = $_POST['term']; $PartNum = sanitize_text_field( $_POST['term'] ); update_post_meta( $post->ID, 'term', $PartNum ); $query_Parts = $wpdb->get_results( "SELECT * FROM parts WHERE parts.PartNumber LIKE '%$PartNum%' or parts.nsn LIKE '%$PartNum%'"); if ( ! empty( $query_Parts ) ) : ?> <header class="page-header"> <h1 class="page-title"><?php printf(__( 'Search Results for: %s', 'catalog-me' ), '<span>' . $_POST['term'] . '</span>' ); ?></h1> </header><!-- .page-header --> <?php //echo "<pre>"; print_r($query_Parts); echo "</pre>"; echo '<table class="results"><thead><tr><th>Part Number</th><th>NSN</th><th>Alternate Part Number</th><th>Description</th><th>Condition</th><th>Quantity</th></tr></thead><tbody>'; foreach($query_Parts as $row) { echo '<tr>'; echo "<td>{$row->PartNumber}</td>"; echo "<td>{$row->nsn}</td>"; echo "<td>{$row->nsn2}</td>"; echo "<td>{$row->Description}</td>"; echo "<td>{$row->Condition}</td>"; echo "<td>{$row->CVQuantity}</td>"; echo '</tr>'; } echo '</tbody></table>'; ?> <?php else : ?> <h2 class="center">P/N: <?php echo $PartNum; ?> Not Found</h2> <p class="center">Sorry, it doesn't look like we have Part Number <?php echo $PartNum; ?> in our Inventory database. Try a new search with Alternate Part Number or NSN.</p> <?php endif; ?> </main><!-- #main --> </section><!-- #primary --> </div> <?php get_footer();
It has been so long that I have had to work on any coding so I am having trouble trying to figure out where to start to fix it!
Any help would be greatly appreciated. Thank you!
-Amy
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Part Search Box just disappeared’ is closed to new replies.