944,124 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 506
  • PHP RSS
Nov 7th, 2009
0

My Form wont show up

Expand Post »
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
PHP Syntax (Toggle Plain Text)
  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
PHP Syntax (Toggle Plain Text)
  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

PHP Syntax (Toggle Plain Text)
  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

PHP Syntax (Toggle Plain Text)
  1. </div>
  2.  
  3. </body>
  4. </html>
Last edited by daryll1; Nov 7th, 2009 at 7:51 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
daryll1 is offline Offline
41 posts
since Nov 2009
Nov 7th, 2009
-1
Re: My Form wont show up
PHP Syntax (Toggle Plain Text)
  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 ".

PHP Syntax (Toggle Plain Text)
  1. <style media="screen">.error { color: red;}</style>';
  2.  

The above should be in the 'head' area not in the 'body'.
Sponsor
Featured Poster
Reputation Points: 1067
Solved Threads: 955
Disgraced Poster
ardav is offline Offline
6,728 posts
since Oct 2006
Nov 7th, 2009
0
Re: My Form wont show up
i see, thankyou, managed to get it working now
Reputation Points: 10
Solved Threads: 1
Light Poster
daryll1 is offline Offline
41 posts
since Nov 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Make HTML page through PHP script
Next Thread in PHP Forum Timeline: PHP and webcam





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC