PHP craeting non-valid script (Technically me lol)

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

PHP Code: [ Select ]
<?php
if(count($errors) === 0) {
 echo '<div id="fsuccess">'."\n";
 echo '<fieldset id="fsuccessf">'."\n";
 echo '<form action="pfsubmit.php" method="post">'."\n";
 echo '<input type="hidden" value="'. $firstName .'" />'."\n";
 echo '<input type="hidden" value="'. $lastName .'" />'."\n";
 echo '<input type="hidden" value="'. $myEmail .'" />'."\n";
 echo '<input type="hidden" value="'. $myPass .'" />'."\n";
 echo '<input type="hidden" value="'. $secretQueston .'" />'."\n";
 echo '<input type="hidden" value="'. $ansSecretQuestion .'" />'."\n";
 echo '<p>The registration was filled in correctly:</p>'."\n";
 echo '<ul>'."\n";
 foreach($success as $value2) {
   echo $value2;
 }
 echo '</ul>'."\n";
 echo '<p><input type="submit" value="continue" name="continue" /> or <a href="register.php">Restart</a></p>'."\n";
 echo '</form>'."\n";
 echo '</fieldset>'."\n";
 echo '</div>'."\n";
}
?>
 
  1. <?php
  2. if(count($errors) === 0) {
  3.  echo '<div id="fsuccess">'."\n";
  4.  echo '<fieldset id="fsuccessf">'."\n";
  5.  echo '<form action="pfsubmit.php" method="post">'."\n";
  6.  echo '<input type="hidden" value="'. $firstName .'" />'."\n";
  7.  echo '<input type="hidden" value="'. $lastName .'" />'."\n";
  8.  echo '<input type="hidden" value="'. $myEmail .'" />'."\n";
  9.  echo '<input type="hidden" value="'. $myPass .'" />'."\n";
  10.  echo '<input type="hidden" value="'. $secretQueston .'" />'."\n";
  11.  echo '<input type="hidden" value="'. $ansSecretQuestion .'" />'."\n";
  12.  echo '<p>The registration was filled in correctly:</p>'."\n";
  13.  echo '<ul>'."\n";
  14.  foreach($success as $value2) {
  15.    echo $value2;
  16.  }
  17.  echo '</ul>'."\n";
  18.  echo '<p><input type="submit" value="continue" name="continue" /> or <a href="register.php">Restart</a></p>'."\n";
  19.  echo '</form>'."\n";
  20.  echo '</fieldset>'."\n";
  21.  echo '</div>'."\n";
  22. }
  23. ?>
  24.  


I'm using the above script to create the validation. it works perfectly but it brings up HTML errors... Below are the created lines from that script that brings up errors...

HTML Code: [ Select ]
<input type="hidden" value="Firstname" />
<input type="hidden" value="lastname" />
<input type="hidden" value="myemail@forvalid.com" />
<input type="hidden" value="mypass" />
<input type="hidden" value="My secret question" />
<input type="hidden" value="My secret answer" />
 
  1. <input type="hidden" value="Firstname" />
  2. <input type="hidden" value="lastname" />
  3. <input type="hidden" value="myemail@forvalid.com" />
  4. <input type="hidden" value="mypass" />
  5. <input type="hidden" value="My secret question" />
  6. <input type="hidden" value="My secret answer" />
  7.  

The errors say...
Quote:
line 46 column 40 - Error: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

All of those lines have the same error andI can't get it to validate... I tried putting them in <p>...</p> but since the fields are hidden and are not seeing, the whole page below those fields seem to be shifted some ways to the bottom (and still invalid). I added a class to them with the bottom margin of -10. That worked but the script stayed invalid with the bonus errors... it read the <p>...</p> tags as errors... didn't associate the </p> tags with the <p> tags :banghead:

I can't figure it out... my registration form is without errors and I put it inside the <fieldset> script and yet it still brings those errors... :x any help would be great.

(This might have to go to HTML forum... not so sure :oops: :lol:)
  • cipher
  • Graduate
  • Graduate
  • User avatar
  • Posts: 157

Post 3+ Months Ago

I think you need <p> or a <div> or whatever element as a child of <form>. In other words you cannot put input, textarea, etc. as a direct child of the form.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Your <input> elements seem to be missing their name attributes.

Having your <form> contain the <fieldset> instead of the other way around should prevent these errors from ever occuring.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Thank you cipher and joebert. I appreciate your help...

Now that you mention it, I see that I did that on my registration form but not on this form :oops:

Also, thanks joebert about the name attributes :) Looks like I forgotten about those

Thanks so much :D I appreciate it a lot :D

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.