• Hi,
    I’ve created a custom form and saved it as a page template in my page-templates folder, then created a page and set its template to this custom template. I’ve set the form action to “archive-post.php”, so that it will send the post data to the archive-post.php file. When I click submit on my form, it takes me to archive-post.php, but it’s completely blank (should display “it worked?”). If I remove the get_header(); call it displays that line correctly, if I add it back in, it doesn’t. So, it makes sense that there’s something wrong with my header.php? But header.php works fine with all my other pages, so I’m wondering if it has something to do with where I put my templates? Maybe it can’t find the header, because of its path?

    My code is below, any ideas?:

    archive-post.php

    <?php
    /**
     * Template Name: Search Results Page
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    it worked?
    
    <?php
    get_sidebar( 'content' );
    get_sidebar();
    get_footer();

    archive-search.php

    <?php
    /**
     * Template Name: Search Page
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    <div id="search">
    	Search Page
    	<br>
    	<table class="searchTable">
    	Equipment Search Options
    		<form action="wp-content/themes/Saisselin_Print/archive-post.php" method="post">
    			<tr>
    				<td>
    					Item name:
    				</td>
    				<td><input type="text" name="e-itemname">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Borrower name:
    				</td>
    				<td><input type="text" name="e-borrowername">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					<select name='Availability'>
    					  <option value=''>Availability</option>
    					  <option value='in'>In</option>
    					  <option value='out'>Out</option>
    					  <option value='Broken'>Broken</option>
    					</select>
    				</td>
    			</tr>
    			<tr>
    				<td>
    				<input type="submit" value="Submit">
    				</td>
    			</tr>
    		</form>
    	</table>
    	<table class="searchTable">
    	Print Record Search Options
    		<form action="archive-post.php" method="post">
    			<tr>
    				<td>
    					Date:
    				</td>
    				<td><input type="text" name="p-date">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Student Name:
    				</td>
    				<td><input type="text" name="p-studentname">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Paper Type:
    				</td>
    				<td><input type="text" name="p-papertype">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Printer:
    				</td>
    				<td><input type="text" name="p-printer">
    				</td>
    			</tr>
    			<tr>
    				<td>
    				<input type="submit" value="Submit">
    				</td>
    			</tr>
    		</form>
    	</table>
    	<table class="searchTable">
    	Borrow Record Search Options
    		<form action="archive-post.php" method="post">
    			<tr>
    				<td>
    					Date:
    				</td>
    				<td><input type="text" name="b-date">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Student Name:
    				</td>
    				<td><input type="text" name="b-studentname">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Item:
    				</td>
    				<td><input type="text" name="b-item">
    				</td>
    			</tr>
    			<tr>
    				<td>
    				<input type="submit" value="Submit">
    				</td>
    			</tr>
    		</form>
    	</table>
    	<table class="searchTable">
    	Late Record Search Options
    		<form action="archive-post.php" method="post">
    			<tr>
    				<td>
    					Student Name:
    				</td>
    				<td><input type="text" name="l-studentname">
    				</td>
    			</tr>
    			<tr>
    				<td>
    					Item:
    				</td>
    				<td><input type="text" name="l-item">
    				</td>
    			</tr>
    			<tr>
    				<td>
    				<input type="submit" value="Submit">
    				</td>
    			</tr>
    		</form>
    	</table>
    </div>
    
    <?php
    get_sidebar( 'content' );
    get_sidebar();
    get_footer();

  • The topic ‘form that sends post data to archive.php’ is closed to new replies.