using wml variable in php code

714 Views Asked by At

I wrote the following code

<?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>

the problem How I print the entered value in input text inside php code.

2

There are 2 best solutions below

1
On

First of all, you need to define a form in your markup if you want the input fields to do anything. The form should have an action and a method attribute.

Then you can use the $_GET or $_POST superglobal arrays to access the data in the following manner:

echo $_POST['title'];
0
On

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.