For example, after filling in the information on the webpage, click Submit. The webpage prompts that the submission is successful. The other elements on the webpage are the same as those at the beginning, but the forms are gone. My first practice was: an html file, and then a Php, the tag in php is to copy html. But I think this way... for example, after filling in the information on the webpage, click Submit. The webpage prompts that the submission is successful. The other elements on the webpage are the same as those at the beginning, but the forms are gone.
My first practice was: an html file, and then a Php, the tag in php is to copy html.
However, I think this method is very inefficient. If there are many places in a website that need to fill in forms, you cannot copy all elements to php every time, right?
So, what is a better solution?
For example, the index. php file jumps to itself, but how does one hide the previous form?
Reply content:
For example, after filling in the information on the webpage, click Submit. The webpage prompts that the submission is successful. The other elements on the webpage are the same as those at the beginning, but the forms are gone.
My first practice was: an html file, and then a Php, the tag in php is to copy html.
However, I think this method is very inefficient. If there are many places in a website that need to fill in forms, you cannot copy all elements to php every time, right?
So, what is a better solution?
For example, the index. php file jumps to itself, but how does one hide the previous form?
Php page template, or submit with ajax <配合avalon等mvvm更好>
If the submitted person cannot see the form after entering the form, other restrictions should be imposed to record cookie, ip address or other
If this submission only hides the form, you can submit it to index. php.
You are not clear about the basic concepts of php and front-end. I need to add it.
If you are allowed to refresh the page, use the if statement in php for judgment. if a field in the submitted form information has been updated to the database, the html output in the form section will be bypassed, output other html directly.
If you cannot refresh the page, use ajax. It is not difficult to see how ajax is used. Determine whether the submission is successful Based on the returned value. If yes, use js to dynamically hide or delete the form element.
Although you don't quite understand what you mean, you can use $ _ POST [] to receive all the post data.
Not easy to understand
With ajax technology, after the form is submitted successfully, code: 200 is returned, and jquery is used to obtain the form, and then. hide () is hidden.
// Assume that there is a button called submit. if the submit does not exist, the output form will not be output if (! Isset ($ _ POST ['submit ']) {// output form}