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 ("<? 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 ("<? 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= "<? 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.