Html-Train of Thought problem: php form jump

Source: Internet
Author: User
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}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.