My Form wont show up

Thread Solved

Join Date: Nov 2009
Posts: 10
Reputation: daryll1 is an unknown quantity at this point 
Solved Threads: 0
daryll1 daryll1 is offline Offline
Newbie Poster

My Form wont show up

 
0
  #1
Nov 7th, 2009
I am writing a PHP registration form but when i view my page i cannot see the form, any ideas all my code is below.

i have noticed that if i remove the
  1. print '<h1> Please Register To Continue </h1>';
  2. print '<style type="text/"
  3. media="screen>
  4. .error { color: red; }
  5. </style>';
my form is displayed but none of my error messages are

register.php
  1. <?php
  2.  
  3. define('TITLE', 'Register');
  4. include('header.html');
  5.  
  6. print '<h1> Please Register To Continue </h1>';
  7. print '<style type="text/"
  8. media="screen>
  9. .error { color: red; }
  10. </style>';
  11.  
  12. if ( isset($_post['submitted']) ) {
  13.  
  14. $problem = FALSE;
  15.  
  16. if (empty($_POST['fname'])) {
  17. $problem = TRUE;
  18. print '<p class="error">Please Enter Your First Name!</p>';
  19. }
  20. if (empty($_POST['lname'])) {
  21. $problem = TRUE;
  22. print '<p class="error">Please Enter Your Last Name!</p>';
  23. }
  24. if (empty($_POST['email'])) {
  25. $problem = TRUE;
  26. print '<p class="error">Please Enter Your Email Address!</p>';
  27. }
  28. if (empty($_POST['password1'])) {
  29. $problem = TRUE;
  30. print '<p class="error">Please Enter A Password!</p>';
  31. }
  32. if ($_POST['password1'] != $_POST['password2']) {
  33. $problem = TRUE;
  34. print '<p class="error">Please Enter A Password!</p>';
  35. }
  36. if (!$problem) {
  37. print '<p>blah blah need to do this bit of script to MySQL still</p>';
  38. $_POST = array();
  39. } else {
  40. print '<p class="error">Please Try Again</p>';
  41. }
  42. }
  43. ?>
  44.  
  45. <form action="register.php" method="post">
  46.  
  47. <p>First Name: <input type="text" name="fname" size="20" value="<?php if (isset($_POST
  48. ['fname'])) { print htmlspecialchars($_POST['fname']); } ?>" /></p>
  49.  
  50. <p>Last Name: <input type="text" name="lname" size="20" value="<?php if (isset($_POST
  51. ['lname'])) { print htmlspecialchars($_POST['lname']); } ?>" /></p>
  52.  
  53. <p>Email: <input type="text" name="email" size="20" value="<?php if (isset($_POST
  54. ['email'])) { print htmlspecialchars($_POST['email']); } ?>" /></p>
  55.  
  56. <p>Password: <input type="password" name="password1" size="20" /></p>
  57.  
  58. <p>Confirm Password: <input type="password" name="password2" size="20" /></p>
  59.  
  60. <p>Password: <input type="submit" name="submit" value="Register" /></p>
  61.  
  62. <p>Password: <input type="hidden" name="submitted" value="true" /></p>
  63.  
  64. </form>
  65.  
  66. <?php include('footer.html'); ?>

header.html

  1. <!DOCTYPE html PUBLIC "-//WC3//DTD// XHTML 1.0 Transitional//EN">
  2. <html xmins="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <title>Register</title>
  5.  
  6. <style type="text/css">
  7. body {
  8. margin: 0px 0px 0px 0px;
  9. background: #9F9;
  10. }
  11. #leftcontent {
  12. float: left;
  13. width: 67%;
  14. background: #fff;
  15. border-right: 2px solid #000;
  16. border-bottom: 2px solid #000;
  17. margin-right: 15px;
  18. padding-bottom: 20px;
  19. }
  20. p,h1,pre {
  21. margin: 0px 30px 10px 30px;
  22. }
  23. h1 {
  24. font-size: 14px;
  25. padding-top: 10px;
  26. }
  27. #rightcontent p {
  28. font-size: 14px;
  29. margin-left: 0px;
  30. }
  31. </style>
  32.  
  33. </head>
  34. <body>
  35. <div id="leftcontent">
  36. <!-- BEGIN CHANGEABLE CONTENT --!>

footer.html

  1. </div>
  2.  
  3. </body>
  4. </html>
Last edited by daryll1; Nov 7th, 2009 at 7:51 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,097
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 138
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster
 
-1
  #2
Nov 7th, 2009
  1. print '<style type="text/"
  2. media="screen>
  3. .error { color: red; }
  4. </style>';

This is wrong. You have a mess. If you delete this the form will show. You have an unclosed ". So everything that follows is assumed to be an attribute value until we reach the next ".

  1. <style media="screen">.error { color: red;}</style>';
  2.  

The above should be in the 'head' area not in the 'body'.
If you don't reply to your own thread or you can't find the solved link - you're off my Christmas list - permanently! Bah humbug!
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 10
Reputation: daryll1 is an unknown quantity at this point 
Solved Threads: 0
daryll1 daryll1 is offline Offline
Newbie Poster
 
0
  #3
Nov 7th, 2009
i see, thankyou, managed to get it working now
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 259 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC