hi
i am trying to develop a site.i am using php and wml.this is my first program.can any one say why my below code is not woking

<?php
header("Content-type: text/vnd.wap.wml");
echo " xml version=\"1.0\" ";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

?>
<wml>
<card>
<?
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result)) 
  {
  echo $row[0];
  }
?> 
</card>
</wml>
<?xml version="1.0" ?>

xml declaration so the php should look something like

<?php
echo "<?xml version=\"1.0\" ?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card>
<?php /* declare script type short tags may be off other script languages may be available saves debugging later*/
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result))  {  echo $row[0];  }
?> 
</card>
</wml>
<?php
header("Content-type: text/vnd.wap.wml");
echo " xml version=\"1.0\" ";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

?>
<wml>
<card>
<?
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result)) 
  {
  echo $row[0];
  }
?> 
</card>
</wml>

Line 2: Start tag expected, '<' not found.
it is showing the above error

<?xml version=\"1.0\" ?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1 EN "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card>
<?php
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);  
while ($row = mysql_fetch_array($result))  {  echo $row[0];  }
?> </card></wml>

maybe

Line 1: String not started expecting ' or "
Line 1: Malformed declaration expecting version
Line 1: Blank needed here
Line 1: parsing XML declaration: '?>' expected
Line 2: SystemLiteral " or ' expected
Line 2: PUBLIC, the Public Identifier is missing
Line 2: Space required after the Public Identifier
Line 2: SystemLiteral " or ' expected
Line 2: SYSTEM or PUBLIC, the URI is missing
Line 2: DOCTYPE improperly terminated
Line 2: Start tag expected, '<' not found
these are the errors.i am WAP proof to execute my code.plz do tell me whether i right

You probably have short open tags enabled in the PHP config. So it would see the xml declaration as an opening PHP tag.

In PHP.ini disable short open tags by finding "short_open_tag" and making the value "0".

You can also seperate the < and ? in <?xml so it doesn't look like a PHP open tag (<?).

eg:

<?php
echo "<"."?xml version=\"1.0\" ?>";

notice that you have "<"."?xml instead of "<?xml.

You can also remove the xml declaration, and use the HTTP content-type header.

<?php

header('Content-Type: text/xml');
This article has been dead for over six months. Start a new discussion instead.