Jump to content
Larry Ullman's Book Forums

exodia

Members
  • Content Count

    17
  • Joined

  • Last visited

Everything posted by exodia

  1. I see.. so there's no solution for it except to tell them not to doing it. ok then thanks Hartley.
  2. I'm just afraid if my client which have a slow connection or have connection is interrupted they will refresh the pages. it will cause the data will be resubmitted. I can't say to them to click on URL and hit enter. I know that jQuery will solve this, but what is the trick for PHP if I only use PHP.
  3. it's the same. i use this code as part of my script too. i think this is the risk using single page to submit and receive form using php.
  4. i think i found the problem. this problem occur because i use the same page to submit a form by using this code } elseif ($values === 'POST') { so when i do refresh the page it will resubmit the form. i read some book and found that to prevent this to happen is by using HTTP redirect. but i wonder is it any other effective way to prevent this beside using HTTP redirect.
  5. I just notice when i refresh the pages, data that i've entered before is resubmitted. is it because your sticky form function? is it any way to prevent this to happen? thanks.
  6. one more question, is it any PHP or other script that I can use to detect post_max_size or upload_max_size so i can make error handler from it, or is it checking my client hosting setting is the only way to prevent this error? thanks.
  7. it's not just for me, but for my client if I have to write a script for them. it should be any warning to show them that the upload file fail because some problem. it will confusing for my client if the upload is failing, but the page show nothing. at least it give a notice that upload is error and to contact administrator.
  8. i'm runing on my computer. because you mention that there's other setting i was go search and check my php setting again and found that the one that cause the error was post_max_size. now the only thing i can't understand is why error handler that you make or switch error in the script is showing nothing? is it anything we can do to check and show if there is an error at post_max_size or upload_max_size? thanks.
  9. i think i know the error, it's always error when i'm upload the file more than 3MB, this is really confuse me, i check my php.ini again and my upload_max_filesize = 64M, meanwhile your code is allow file to be upload 5MB. if the file is too large your code suppose show error that the file is too large right? then why it isn't instead it print the form code? when the file is succeed the print_r is work it print like this: Array ( [name] => GoogleCash - Using Google AdWords 3.1.pdf [type] => application/pdf [tmp_name] => E:\wamp\tmp\phpB1AA.tmp [error] => 0 [size] =>
  10. i already put the code: // Check for a form submission: if ($_SERVER['REQUEST_METHOD'] === 'POST') { print_r($_FILES['pdf']); but i still got the warning and nothing to show: and at the form i got some error which tell me that i should write the file and description although i already do it:
  11. i'm changing the switch error code as you said like this: } elseif (!isset($_SESSION['pdf'])) { // No current or previous uploaded file. print_r($_FILES['pdf']); } // End of $_FILES IF-ELSEIF-ELSE. am I doing it right? because i still saw nothing.
  12. when i disable Larry error-handler that code is disappear but i got this messages:
  13. here's the code for that add_pdf.php <?php // This page is used by an administrator to add a PDF to the site. // This script is created in Chapter 5. // Require the configuration before any PHP code as the configuration controls error reporting: require('./includes/config.inc.php'); // If the user isn't logged in as an administrator, redirect them: redirect_invalid_user('user_admin'); // Require the database connection: require(MYSQL); // Include the header file: $page_title = 'Add a PDF'; include('./includes/header.html'); // For storing errors: $add_pdf_errors = array(); // Chec
  14. it's not the matter the file size, I've upload the file under 5 MB, and i already change the file size into 15 MB and set my php.ini more than 10MB and it's still the same. I think there's some problem on script that i missed. if it's error it supposes show error messages from error handler or from php it self rather than the code above.
  15. i try to upload pdf file, it work but when i try another pdf it's fail. instead rather than show me the error it show me this code: <input type="hidden" name="MAX_FILE_SIZE" value="5242880"> <fieldset><legend>Fill out the form to add a PDF to the site:</legend> <div class="form-group has-error"><label for="title" class="control-label">Title</label><input type="text" name="title" id="title" class="form-control"><span class="help-block">Please enter the title!</span></div><div class="form-group has-error"><label
×
×
  • Create New...