• as the title denotes im passing HTML variables from one page to PHP script on another page. The page with the HTML form is a wordpress template and the page that I am trying to send the variables to is a custom made template that i made by modfying the page.php file in the theme folder which i saved as searchresult.php.

    This is the code from the submit page:

    <form action="searchresult.php" method="post"><input type="text" name="HTML_Width" placeholder="Width" /> <input type="text" name="HTML_Height" placeholder="Height" />
    <!--Radio Buttons-->
    <input type="radio" name="HTML_MeasurementType" value="standard" />Inches
    <input type="radio" checked="checked" name="HTML_MeasurementType" value="metric" />Millimeters
    <!--Search Button-->
    <input type="submit" name="search" value="Search" /></form>

    when ever i submit this form i just get a blank page. what am i doing wrong?

    Here the part of the PHP code from the results page.

    <?php
    /*
    Template Name: Search Results
    */
    ?>
    
    <?php get_header(); ?>
    <?php dt_storage('have_sidebar', true); ?>
    
    <?php get_template_part('top-bg'); ?>
    
    <?php get_template_part('parallax'); ?>
    
    <div id="wrapper">
    
    <?php get_template_part('nav'); ?>
    
    <div id="container">
    
    <?php
    if( have_posts() ) {
        while( have_posts() ) {
            the_post();
            the_content();
        }
    }
    ?>
    
    <h1 style="max-width: 962px;">Search Results</h1>       
    
    <div class="hr hr-wide gap-big"></div>
    
    <form method="post">
    <input type="text" name="HTML_Width" placeholder='Width'/> <input type="text" name="HTML_Height" placeholder='Height'/> <input type="radio" name="HTML_MeasurementType" value="standard">Inches <input checked  type="radio" name="HTML_MeasurementType" value="metric">Millimeters <input type="submit" name="search" value="Search"/>
    </form>            
    
    <div class="hr gap-big"></div> 
    
    	<?php
    
    		include 'datalogin.php';
    		//MySQL Database Connect.
    
                    $min_length = 1;
    
    	?>
    
    <body>
    
    		<?php
    			if (isset($_POST['HTML_Width']) && isset($_POST['HTML_Height']) && is_numeric($_POST['HTML_Width']) && is_numeric($_POST['HTML_Height']))
    				{
    					$php_Width = $_POST['HTML_Width'];
    					$php_Height = $_POST['HTML_Height'];
    					$php_Type = $_POST['HTML_MeasurementType'];
    					// gets values sent from search form
    
    					$min_length = 1;
    					// set query minumum length
  • The topic ‘Passing HTML variables from one page to PHP script on another page’ is closed to new replies.