Missing Something simple in Form POST

Howdy! I’m missing something very simple in this code and I can’t see it. Can someone lend a quick pair of eyes. I know it’s something basic but my coffee isn’t working this morning. Thanks in advance.

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<label for="add_header_text_opt">Display Header Option</label>
<input type="checkbox" name="add_header_text_opt" value="Yes" />
<p><input type="submit" name="search" value="Create Options" class="button" /></p>
</form>
<?php
if(isset($_POST["submit"])) : ?>
	<form method="post" action="">
		<?php if(isset($_POST["add_header_text_opt"]) && $_POST["add_header_text_opt"] = "Yes") : ?>
			<label for="header_text">Enter text to display in header</label><br />
			<input type="text" name="header_text" value="Enter Header Text" />

		<?php endif; ?>
	</form>
	<?php else : ?>
	<p>Submit form and your New element should show here</p>
	<?php endif; ?>

<html>
  <head>
    <title>Demo</title>
  </head>
  <body>
    <form method="post" action="">
      
      <label for="header_text_option">
        Display Header?
      </label>
      <input type="checkbox" id="header_text_option" name="header_text_option" />
      
      <?php if(array_key_exists('header_text_option', $_POST)): ?>
        <label for="header_text">
          Enter text to display in header
        </label>
        <input type="text" name="header_text" value="Enter Header Text" />
      <?php endif; ?>
      
      <input type="submit" value="Submit" />
      
    </form>
  </body>
</html>

:slight_smile:

Edit:
Bah, too slow!

$_POST[“submit”] doesn’t exist. Your button is called ‘search’ not ‘submit’.

Never mind. Glad you found it yourself :slight_smile:

Thanks guido2004. With you asking that question I looked at my form again and the submit button had the wrong name in the name element. How frustrating!
Thanks again

Sorry 'bout that. When I select the check box and submit the form the label and input do not show in the new form.

Care to tell us what the problem is?