Web backend-end character "?>" When html code is embedded in php" Why is the location placed like this?

Source: Internet
Author: User
Hello everyone, I am a beginner in php. I don't understand html and php code embedding. For example: {code ...} why is "}" placed separately in & amp; lt ;? Php? & Amp; gt; medium. Why can't I write it like this? {Code...} Thank you very much for answering your questions! Hello, I am a beginner in php. I don't understand how to embed html and php code,

For example:


  

There were some problems with the form you submitted.Please complete the fields highlighted below and click Send Details to resend the form.

Thanks for choosing to join The Widget Club. To register, please fillin your details below and click Send Details. Fields marked with an asterisk(*) are required.

Why is "}" stored separately in . Why can't I write it like this?


  There were some problems with the form you submitted.Please complete the fields highlighted below and click Send Details to resend the form.

} else {

Thanks for choosing to join The Widget Club. To register, please fillin your details below and click Send Details. Fields marked with an asterisk(*) are required.

}

Thank you very much for answering your questions!

Reply content:

Hello, I am a beginner in php. I don't understand how to embed html and php code,

For example:


  

There were some problems with the form you submitted.Please complete the fields highlighted below and click Send Details to resend the form.

Thanks for choosing to join The Widget Club. To register, please fillin your details below and click Send Details. Fields marked with an asterisk(*) are required.

Why is "}" stored separately in . Why can't I write it like this?


  There were some problems with the form you submitted.Please complete the fields highlighted below and click Send Details to resend the form.

} else {

Thanks for choosing to join The Widget Club. To register, please fillin your details below and click Send Details. Fields marked with an asterisk(*) are required.

}

Thank you very much for answering your questions!

Because

Tags belong to html rather than php, so they cannot be added to the starting and ending symbols of php.


It indicates the end symbol of the php code block "}"

Because

There were some problems with the form you submitted.Please complete the fields highlighted below and click Send Details to resend the form.

Invalid PHP code.

  1. In In php code, the second writing method is very obvious.

    The content in is not the php code.

  2. If you want to use the second method, you can write as follows:


   ... 

'; } else { echo '

...

'; } ?>

AllNon-html codeMust be embedded in And all It will be parsed into php Code. According to your ideas, that pair

The content in the label does not belong to the php code, so it should be embedded in segments as follows:


  xxx
  xxx
  

7048
It should be understood in this way.
In php,?> Starting to output html,

You can do this:


      

There were some problems with the ....

Thanks for choosing to join The Widget Club....

The syntax start label of PHP is PHP must be written in this way !!!

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.