when christmas comes to town Create a dynamic WML site 2

WBOY
Release: 2016-07-29 08:33:27
Original
775 people have browsed it

Write PHP/WML code
Now we write the first PHP/WML page, named index.wml
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
echo ("");
? >
"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 how to receive it. What type of content does it belong to, and with this line, the file extension is not important. This function is very useful if you want to write a multi-style page. You can use a script to detect the device or its capabilities, and then return WML or HTML according to the browser type.
 Check whether PHP has short tag support installed. If so, you could do something like declaration, and nest it into the PHP code to avoid confusion.
 The rest of the code on this page just lets you search for quiz times or consultation times. The selected item will be recorded in the $choice variable.
The next page is called index2.wml, which allows you to choose whether to query the database by subject or last name.
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
echo ("");
? >
"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><BR>Select the kind of research. <BR><P>
< SELECT name=" ? >" value="surname" title="research"> <OPTION selected value=surname>professor's name</OPTION> <OPTION value=subject>subject</OPTION>

The above has introduced the second step of establishing a dynamic WML site when christmas comes to town, including the content of when christmas comes to town. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!