PHP in HTML


Within HTML source code, start and end tags identify the PHP code. The standard PHP tag is recommended, but any one of the following tags can designate PHP:

Standard PHP tag

< ?php < PHP_code > ? >

Shortcut PHP tag

< ? < PHP_code > ? >

ASP-style PHP tag

< % < PHP_code > % >

Script PHP tag

< script language="PHP" > < PHP-code > < /script >

Since these tags are HTML constructs, they are not case-sensitive; however, it is most common and recommended that you use the standard tags with lowercase < ?php ? >. Most web servers are configured to use the filename extension .php, rather than .html, for a file containing PHP. This tells the web server to use the PHP interpreter on the file before displaying it.

Caution  

While the PHP tags themselves are not case-sensitive, the code that is enclosed within them is case-sensitive.

You can use the HTML < FORM > tag to define boxes for user input. A global array variable called _POST gets an entry for each input name in the form. This _POST array is a data link between the HTML forms and PHP, and it can be used in the PHP code in the same way as any other variable defined in the PHP block. The following is an example of an HTML < FORM > that creates a text _POST array entry called userinput .

 <FORM METHOD="post"> Enter Data: <INPUT TYPE="text" NAME="userinput"> </FORM> 

If the < FORM > has only one text-entry field, pressing the ENTER key will submit the form. However, when there are multiple text-entry fields, a submit button is needed. You can create a submit button within a < FORM > input block with the code TYPE=SUBMIT .




MySQL(c) Essential Skills
MySQL: Essential Skills
ISBN: 0072255137
EAN: 2147483647
Year: 2006
Pages: 109

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net