943,923 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 589
  • PHP RSS
Mar 1st, 2008
0

doesnt show anything

Expand Post »
i am new to PHP. instead i learned the basic from w3schools and tizag. i'd created a registration form-like page using php tags, however when i uploaded to a php-based web hosting, i cant see anything..it juz show done in the browser status with blank page. Anyone kind enuf to check for me? much appreciate to those who help. Thanks.

PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $username = $_POST["name"];
  3. $password = $_POST["password"];
  4. $status = $_POST["status"];
  5. $department = $_POST ["depart"];
  6. $duemonth = $_POST ["due"];
  7. $category = $_POST ["cate"];
  8. $amount = $_POST ["amount"];
  9. $specification = $_POST ["spec"];
  10. if(!isset($_POST['submit'])){
  11. ?>
  12. <html>
  13. <head>
  14. <title>::. CLAIM FORM</title>
  15. <link rel="stylesheet" type="text/css"
  16. href="my.css">
  17. </head>
  18. <body>
  19. <br><br><br><br><br><br><br><br><br><br><br>
  20. <h1>Welcome to the claim page.</h1>
  21. <hr size=2 width=500px>
  22. <h1>Please fill in all the details as required. Incomplete data
  23.  
  24. will not be considered.</h1>
  25. <div class="form-container">
  26. <form method="post" action="<?php echo $PHP_SELF;?>">
  27.  
  28. <div><label>Name:<?php echo $_POST["name"];?
  29.  
  30. ></label><br></div>
  31. <div><label
  32.  
  33. for="type">Department:</label>
  34. <select name="depart">
  35. <optgroup label="---
  36.  
  37. SELECT---">
  38.  
  39.  
  40. <option>KKK</option>
  41. <option>KEE</option>
  42. <option>KPM</option>
  43. <option>KMP</option>
  44. <option>KKA</option>
  45. <option>KBP</option>
  46. <option>KAA</option>
  47. </optgroup>
  48. </select>
  49. </div>
  50.  
  51. <div><label for="type">Due month:</label>
  52. <select name="due">
  53. <optgroup label="---
  54.  
  55. SELECT---">
  56. <option>JAN</option>
  57. <option>FEB</option>
  58. <option>MAC</option>
  59. <option>APR</option>
  60. <option>MAY</option>
  61. <option>JUN</option>
  62. <option>JUL</option>
  63. <option>AUG</option>
  64. <option>SEP</option>
  65. <option>OCT</option>
  66. <option>NOV</option>
  67. <option>DEC</option>
  68. </optgroup>
  69. </select>
  70. </div>
  71. <div><label for="type">Category:</label>
  72. <select name="cate">
  73. <optgroup label="---
  74.  
  75. SELECT---">
  76.  
  77.  
  78.  
  79. <option>Faks</option>
  80.  
  81.  
  82. <option>Electricity</option>
  83. <option>Road
  84.  
  85. tax</option>
  86. <option>Vehicle
  87.  
  88. insurance</option>
  89.  
  90.  
  91. <option>Petrol</option>
  92. </optgroup>
  93. </select>
  94. </div>
  95. <div><label for="name">Amount:</label></div>
  96. <div><input type="text" name="amount"
  97.  
  98. value="RM"></div>
  99.  
  100.  
  101. <div><label for="name">Specification:</label> <input
  102.  
  103. type="text" name="spec" size="50"/></div>
  104. </form>
  105.  
  106. <h1>Please upload the bill as we may process it as soon as
  107.  
  108. possible. Thank You.</h1>
  109.  
  110. <form enctype="multipart/form-data" action="uploader.php"
  111.  
  112. method="POST">
  113. <input type="hidden" name="MAX_FILE_SIZE" value="100000" >
  114. <h1>Choose a file to upload:</h1>
  115. <div><label><input name="uploadedfile" type="file" ><input
  116.  
  117. type="submit" value="Upload File" ></label>
  118. </div></form>
  119.  
  120. <br>
  121. <p class="submit"><input type="submit" value="Submit" ></p>
  122. </div>
  123. </body>
  124. </html>
  125. <?
  126. } else {
  127. <h1> Below is the infos you had submitted:</h1>
  128. echo "<h1>Department:</h1>" .$department.".<br/>";
  129. echo "<h1>Due month:</h1>" .$duemonth.".<br/>";
  130. echo "<h1>Category:</h1>" .$category.".<br/>";
  131. echo "<h1>Amount:</h1>" .$amount.".<br/>";
  132. echo "<h1>Specification:</h1>" .$specification.".<br/>";{
  133. echo $f."<br />";
  134. }
  135. }
  136. ?>
Last edited by evios; Mar 1st, 2008 at 11:09 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Mar 1st, 2008
0

Re: doesnt show anything

<div><label>Name:<?php echo $_POST["name"];? ></label><br></div> In this line, you have a whitespace after $_POST["name"];? here > It should have been like ?> .
Turn on error reporting. It will help you identify your errors. If you have access to php.ini file, turn on display_errors. If you don't have access to php.ini file, then, put
php Syntax (Toggle Plain Text)
  1. ini_set("display_errors","on");
  2. error_reporting(E_ALL);
in your script.

Cheers,
Naveen

Edit: More about error_reporting here .

Edit 2: And here is one more error. This line should be echo'ed as well.
<h1> Below is the infos you had submitted:</h1> Should have been echo "<h1> Below is the infos you had submitted:</h1>";
Edit 3:
{
echo $f."<br />";
}
What is this for ? This loop don't have a condition ! { } wont do anything.
Last edited by nav33n; Mar 1st, 2008 at 11:27 am.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Mar 1st, 2008
0

Re: doesnt show anything

thanks for your help....it works!!!
Last edited by evios; Mar 1st, 2008 at 11:42 am.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Mar 1st, 2008
0

Re: doesnt show anything

php Syntax (Toggle Plain Text)
  1. <?php
  2. ini_set("display_errors","on");
  3. error_reporting(E_ALL);
  4. $username = $_POST["name"];
  5. $password = $_POST["password"];
  6. $status = $_POST["status"];
  7. $department = $_POST ["depart"];
  8. $duemonth = $_POST ["due"];
  9. $category = $_POST ["cate"];
  10. $amount = $_POST ["amount"];
  11. $specification = $_POST ["spec"];
  12. if(!isset($_POST['submit'])){
  13. ?>
  14. <html>
  15. <head>
  16. <title>::. CLAIM FORM</title>
  17. <link rel="stylesheet" type="text/css"
  18. href="my.css">
  19. </head>
  20. <body>
  21. <br><br><br><br><br><br><br><br><br><br><br>
  22. <h1>Welcome to the claim page.</h1>
  23. <hr size=2 width=500px>
  24. <h1>Please fill in all the details as required. Incomplete data
  25.  
  26. will not be considered.</h1>
  27. <div class="form-container">
  28. <form method="post" action="<?php echo $PHP_SELF;?>">
  29.  
  30. <div><label>Name:<?php echo $_POST["name"];?></label><br></div>
  31. <div><label
  32.  
  33. for="type">Department:</label>
  34. <select name="depart">
  35. <optgroup label="---
  36.  
  37. SELECT---">
  38.  
  39.  
  40. <option>KKK</option>
  41. <option>KEE</option>
  42. <option>KPM</option>
  43. <option>KMP</option>
  44. <option>KKA</option>
  45. <option>KBP</option>
  46. <option>KAA</option>
  47. </optgroup>
  48. </select>
  49. </div>
  50.  
  51. <div><label for="type">Due month:</label>
  52. <select name="due">
  53. <optgroup label="---
  54.  
  55. SELECT---">
  56. <option>JAN</option>
  57. <option>FEB</option>
  58. <option>MAC</option>
  59. <option>APR</option>
  60. <option>MAY</option>
  61. <option>JUN</option>
  62. <option>JUL</option>
  63. <option>AUG</option>
  64. <option>SEP</option>
  65. <option>OCT</option>
  66. <option>NOV</option>
  67. <option>DEC</option>
  68. </optgroup>
  69. </select>
  70. </div>
  71. <div><label for="type">Category:</label>
  72. <select name="cate">
  73. <optgroup label="---
  74.  
  75. SELECT---">
  76.  
  77.  
  78.  
  79. <option>Faks</option>
  80.  
  81.  
  82. <option>Electricity</option>
  83. <option>Road
  84.  
  85. tax</option>
  86. <option>Vehicle
  87.  
  88. insurance</option>
  89.  
  90.  
  91. <option>Petrol</option>
  92. </optgroup>
  93. </select>
  94. </div>
  95. <div><label for="name">Amount:</label></div>
  96. <div><input type="text" name="amount"
  97.  
  98. value="RM"></div>
  99.  
  100.  
  101. <div><label for="name">Specification:</label> <input
  102.  
  103. type="text" name="spec" size="50"/></div>
  104. </form>
  105.  
  106. <h1>Please upload the bill as we may process it as soon as
  107.  
  108. possible. Thank You.</h1>
  109.  
  110. <form enctype="multipart/form-data" action="uploader.php"
  111.  
  112. method="POST">
  113. <input type="hidden" name="MAX_FILE_SIZE" value="100000" >
  114. <h1>Choose a file to upload:</h1>
  115. <div><label><input name="uploadedfile" type="file" ><input
  116.  
  117. type="submit" value="Upload File" ></label>
  118. </div></form>
  119.  
  120. <br>
  121. <p class="submit"><input type="submit" value="Submit" ></p>
  122. </div>
  123. </body>
  124. </html>
  125. <?
  126. } else {
  127. echo "<h1> Below is the infos you had submitted:</h1>";
  128. echo "<h1>Department:</h1>" .$department.".<br/>";
  129. echo "<h1>Due month:</h1>" .$duemonth.".<br/>";
  130. echo "<h1>Category:</h1>" .$category.".<br/>";
  131. echo "<h1>Amount:</h1>" .$amount.".<br/>";
  132. echo "<h1>Specification:</h1>" .$specification.".<br/>";
  133. echo $f."<br />";
  134. }
  135. ?>

Check this and compare it with your script. Oh, btw, you can ignore notices(if you get any!).
Last edited by nav33n; Mar 1st, 2008 at 11:37 am.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Mar 1st, 2008
0

Re: doesnt show anything

err..however the submit button seems not working..it doesnt show what the user had enter..any syntax error over there?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Mar 1st, 2008
0

Re: doesnt show anything

Ah! thats because, you don't have a name for submit button, but you are checking if submit is set.
if(!isset($_POST['submit'])){ Just give a name to submit button. name="submit" and it will work.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Mar 1st, 2008
0

Re: doesnt show anything

thank you so much nav33n .... much appreciate what u'd trying to help... thanks again...
my prob solved..
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Mar 1st, 2008
0

Re: doesnt show anything

You are welcome!
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Mar 1st, 2008
0

Re: doesnt show anything

by the way, i created a login page, the submit button action is linked to welcome.php which shows the username on it. In this welcome.php also i created a link to the page where the codes shown above. However the username cant be shown at this page.
Look at this:
PHP Syntax (Toggle Plain Text)
  1. <div><label>Name:<?php echo $_POST["name"];?></label><br></div>
which is within form margin. Is there any problem with this as well?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Mar 2nd, 2008
0

Re: doesnt show anything

Nothing wrong with the code. Check if $_POST['name'] is correct. Check all the post-ed form variables by using print_r($_POST) in welcome.php.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007

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: PHP - sending data via hyperlink
Next Thread in PHP Forum Timeline: array





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


Follow us on Twitter


© 2011 DaniWeb® LLC