Home  >  Article  >  Backend Development  >  What should I do if the php form submission cannot be accepted?

What should I do if the php form submission cannot be accepted?

藏色散人
藏色散人Original
2022-11-25 09:46:241492browse

Solution to the problem that php form submission cannot be accepted: 1. Open the php.ini configuration file; 2. Modify the size of the parameters "post_max_sizeupload_max_filesize" and "post_max_size" configured in php.ini.

What should I do if the php form submission cannot be accepted?

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

What should I do if the php form submission cannot be accepted?

PHP form submission_POST cannot be received

Novice PHP learning, record the problems and solutions during the learning process

Problems encountered

Today I am doing a small demo of photo album management. During the process, I uploaded a photo and it was prompted that the upload was successful

But when uploading the second photo, an error message occurred** *Undefined index*** Undefined index

and output "error"

In the project, there are the following judgments, which are to compare the value passed by the form and the session. If the conditions are met, proceed to the next step. One-step judgment, if not satisfied, output an error

What should I do if the php form submission cannot be accepted?

My process of solving the problem

The result is to output "error", that is, the content in else is executed. It means that the condition of if is not satisfied

1. First, I delete the condition behind if and check whether $_POST['token'] exists -----The result is still the same error, so

$_POST['token'] does not exist

2. Check that the value of _SESSION['token'] exists, indicating that the post data has not been submitted

3. Go back and submit The code page of the form checked that there were no syntax errors. I thought there was some unknown problem with the input hidden type.

4. I also checked whether the values ​​of other types of input were passed through. The result was no, which means it is not input. Hidden problem

What should I do if the php form submission cannot be accepted?

5. In the end, it is confirmed that it is not a hidden problem, nor a session problem, then it must be a post delivery problem

Solution

It works when uploading the first photo, but not the second one

After searching on the Internet, I finally solved it

The reason is the second one The two pictures are too big, and the parameter post_max_size I configured in php.ini is too small.

However, what I think is strange is that php does not report an error and cannot directly obtain $POST

Summary

upload_max_filesize The size of a single uploaded file

post_max_size The total size of multiple uploaded files

Recommended learning: "PHP Video Tutorial

The above is the detailed content of What should I do if the php form submission cannot be accepted?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn