When Christmas comes-town builds dynamic WML site two

Source: Internet
Author: User
Write PHP/WML Code
Now we 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 ("&LT;? 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 to receive, and with this line, the file extension is not important. This is useful if you want to write a multi-style page, and you can use a script to detect the device or its performance, and then return WML or HTML depending on the type of browser.
Check to see if PHP has a short tag support installed. If yes, you can do a similar <? XML version= ' 1.0 '? >, and nest it in PHP code to avoid confusion.
The rest of the code on this page is just a time to search for a quiz or a consultation. The selected items are recorded in the $choice variable.
The next page, called INDEX2.WML, lets you choose whether to query the database by account or last name.
Header ("CONTENT-TYPE:TEXT/VND.WAP.WML");
Header ("Cache-control:no-cache, must-revalidate");
Header ("Pragma:no-cache");
Echo ("&LT;? XML version= ' 1.0 '? > ");
? >
"Http://www.wapforum.org/DTD/wml_1.1.xml" >
<WML>
<card id=card2 title= "Kind of the"
<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> <BR> Select the kind of the. <BR> <p>
<select name= "&LT;? php echo ("$choice?); <br>? > "value=" surname "title=" "<option" > Selected Value=surname>professor ' s name </OPTION> <option value= Subject>subject </OPTION>

The above describes when the Christmas comes to the town set up a dynamic WML site two, including when Christmas comes to the town aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • 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.