doesnt show anything

Reply

Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

doesnt show anything

 
0
  #1
Mar 1st, 2008
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.

  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 10:09 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,833
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 344
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: doesnt show anything

 
0
  #2
Mar 1st, 2008
<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
  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 10:27 am.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Re: doesnt show anything

 
0
  #3
Mar 1st, 2008
thanks for your help....it works!!!
Last edited by evios; Mar 1st, 2008 at 10:42 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,833
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 344
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: doesnt show anything

 
0
  #4
Mar 1st, 2008
  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 10:37 am.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Re: doesnt show anything

 
0
  #5
Mar 1st, 2008
err..however the submit button seems not working..it doesnt show what the user had enter..any syntax error over there?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,833
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 344
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: doesnt show anything

 
0
  #6
Mar 1st, 2008
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.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Re: doesnt show anything

 
0
  #7
Mar 1st, 2008
thank you so much nav33n .... much appreciate what u'd trying to help... thanks again...
my prob solved..
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,833
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 344
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: doesnt show anything

 
0
  #8
Mar 1st, 2008
You are welcome!
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Re: doesnt show anything

 
0
  #9
Mar 1st, 2008
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:
  1. <div><label>Name:<?php echo $_POST["name"];?></label><br></div>
which is within form margin. Is there any problem with this as well?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,833
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 344
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: doesnt show anything

 
0
  #10
Mar 2nd, 2008
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.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 522 | Replies: 9
Thread Tools Search this Thread



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

©2003 - 2010 DaniWeb® LLC