• Resolved JV Custom Designs

    (@joshvermaire)


    I can’t get this to work and can’t figure out why.

    <?php
    /*
     Template Name: Test
     */
    ?>
    <?php get_header();?>
    
    <div id="mainbody">
    <?php if(isset($_POST['action'])) {
    echo "Hi";
    } else { ?>
    <form id="test" name="test" method="post" action="">
    		<p><label for="name">Name:</label>
    		<input id="name" name="name" size="10" value="" />
    		</p>
    		<p><input type="submit" value="Test" id="submit" name="submit" /></p>
    		<input type="hidden" name="action" value="post" />
    	</form>
    <?php } ?>
    </div>
    <?php get_footer(); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    To test values of the post array:

    <?php
    /*
     Template Name: Test
     */
    ?>
    <?php get_header();?>
    
    <div id="mainbody">
    echo '<pre>';
    print_r($_POST);
    echo '</pre>';
    <?php if(isset($_POST['action'])) {
    echo "Hi";
    } else { ?>
    <form id="test" name="test" method="post" action="">
    		<p><label for="name">Name:</label>
    		<input id="name" name="name" size="10" value="" />
    		</p>
    		<p><input type="submit" value="Test" id="submit" name="submit" /></p>
    		<input type="hidden" name="action" value="post" />
    	</form>
    <?php } ?>
    </div>
    <?php get_footer(); ?>

    Thread Starter JV Custom Designs

    (@joshvermaire)

    Thanks keesiemeijer. Unfortunately, even with this test code all I get is a 404 when I submit the form. It never actually takes me back to this page, although the url says I’m there.

    Moderator keesiemeijer

    (@keesiemeijer)

    don’t submit a form field called “name”: change

    <input id="name" name="name" size="10" value="" />
    to
    <input id="name" name="myname" size="10" value="" />

    Thread Starter JV Custom Designs

    (@joshvermaire)

    Wow. That’s pretty ridiculous. Thanks a lot. That fixed it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘isset issue’ is closed to new replies.