我写了以下代码
<?xml version="1.0" ?>
<wml>
<card>
title : <input type="text" name="title" /><br/>
body : <input type="text" name="body" /><br/>
<?php
echo $(title)
?>
</card>
</wml>
问题我如何在 php 代码中的输入文本中打印输入的值。
首先,如果您希望输入字段执行任何操作,您需要在标记中定义一个表单。表单应该有一个action
和一个method
属性。
然后您可以使用$_GET
或$_POST
超全局数组以下列方式访问数据:
echo $_POST['title'];
If you want to print the content of a variable directly in the screen of the device (or printer if it is an extended WML browser) you need to do it like this:
$(varName)
In your sample you are setting the value from a server variable, not from the device's memory.
A bit late answer but may help someone, WML is not so common anymore but still it is being used for banking and other kind of automated dispensers.