Build a dynamic WML site (2)

Source: Internet
Author: User
Write the phpWML code. now we write the first PHPWML page named index. wml & lt ;? PhpHeader (& quot; Content-type: textvnd. wap. wml & quot;); Header (& quot; Cache-Control: no-cache, must-revalidate & quot;); Hea write php/WML code

Now let's write the first PHP/WML page named index. wml.

<? Php

Header ("Content-type: text/vnd. wap. wml ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("PRagma: no-cache ");
Echo ("<? Xml version = '1. 0'?> ");
?>

Http://www.wapforum.org/DTD/wml_1.1.xml>
<WML>
<CARD id = card1 title = UNITO/Database> <P>
You can search for professors 'consulting hours or for examinations timetables.
<SELECT name = choice title = Research value = "1"> <OPTION selected value = exams_data> Examinations timetables </OPTION> <OPTION value = consulting_data> Consulting hours </OPTION> </SELECT>
<DO type = "text" label = "Go">
<GO href = "index2.wml # card2" method = "get">
<POSTFIELD value = "$ (choice)" name = "choice">
</GO>
</DO>
</P>
</CARD>
</WML>

The first line tells the browser the MIME type of the file. if there is no header file, the browser does not know what type of content it receives, and with this line, the file extension is not important. This function is very useful for writing a simplified page. you can use a script to check the performance of the device or it, and then return WML or HTML based on the browser type.

Check whether PHP supports short labels. If yes, you can make a similar <? Xml version = '1. 0'?> And nested into PHP code to avoid confusion.

The remaining code on this page only allows you to search for the quiz time or the consulting time. The selected project is recorded in the $ choice variable.
The next page is called index2.wml. you can choose whether to query the database by subject or surname.


Header ("Content-type: text/vnd. wap. wml ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("Pragma: no-cache ");
Echo ("<? Xml version = '1. 0'?> ");
?>
Http://www.wapforum.org/DTD/wml_1.1.xml>
<WML>
<CARD id = card2 title = "Kind of research">
<P> <BR> <? Php
Echo ("You are checking ");

If ($ choice = "exams_data "){
Echo ("examinations timetables. <BR> n ");
} Else if ($ choice = "consulting_data "){
Echo ("consulting hours. <BR> n "); <BR >}else {<BR> echo (" I don't know what and there is some problem. <BR> n ");
}
?>
<P> <BR> You can search by surname (either exact or partial) or by subject (either exact or partial ). <BR> Select the kind of research. <BR> <P>
<SELECT name = "<? Php echo ("$ choice ?); <Br >?> "Value =" surname "title =" research "> <OPTION selected value = surname> extends Sor's name </OPTION> <OPTION value = subject> subject </OPTION>

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.