Solved

WAP noob needs help passing variables to PHP!

Posted on 2004-03-29
5
558 Views
Last Modified: 2013-12-27
OK, I figured I'd try and get my head around WAP a bit cos I've been putting it off for ages. I downloaded the Nokia Internet Kit and I'm using that in conjunctin with Dreamweaver.

So far I've got...

First page shows an image then displays the main menu. Works fine.

One of the choices is 'Search by ID Code' and this opens the following page. Works fine too.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<wml>
     <card id="idsearch" title="Got It Already?">             
          <p><small>
               Please enter your friends ID Code...             
          </small>
               <input name="IDCode" title="ID Code"/>
          <small>
          <anchor>
               Find
              <go href="idres.wml">
                   <postfield name="IDCode" value="$(IDCode)"/>
              </go>
          </anchor>
          <br/>
          <anchor title="Main Index">Main Index<go href="index.wml#index"/></anchor>      
          </small></p>      
     </card>
</wml>

Now I'm trying pass the variable IDCode into PHP which is where I'm getting problems.

If I do the following for idres.wml (which seems to be the way I'm supposed to based on examples in this forum) then I get "Can't open ../path/to/idres.wml?IDCode=12345 -  HTTP Error 500: Server error".

<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\">";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\">";
?>
<wml>
     <card id="idres" title="Got It Already?">
          <P>
      You entered <?php echo $_POST['IDCode']; ?>
          </P>
     </card>
</wml>

Where as if I do the following then the page loads but the variable is empty (just displays 'You entered')...

<?php
header("Content-type: text/vnd.wap.wml");
?>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<wml>
     <card id="idres" title="Got It Already?">
          <P>
      You entered <?php echo $_POST['IDCode']; ?>
          </P>
     </card>
</wml>

I have tried both as .wml files and .php files with the same results. Also, I can see from the error message above that the variable is present in the URL as it should be.

As far as I can tell I was following the examples right so it's probably something obvious. So if someone could point out the obvious to me that would be great.

Cheers,
Andy!
0
Comment
Question by:Reapz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:eicheled
ID: 10710659
Not knowing PHP, but there are inconsistencies in some of the tags (the ? character placement)

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

versus

<?xml version="1.0"?>

Just a shot in the dark :-)
0
 
LVL 6

Author Comment

by:Reapz
ID: 10711715
Thanks but nope that's not it. That's just an oversite.
0
 
LVL 1

Expert Comment

by:psycho_cat_69
ID: 10713125
Try this

You entered <?php echo $_GET['IDCode']; ?>
0
 
LVL 27

Accepted Solution

by:
BigRat earned 250 total points
ID: 10713562
<go href="idres.wml">

needs to be :-

<go href="idres.wml" method="post">

since the default is "get" and consequently the "posted" value is not posted!
0
 
LVL 6

Author Comment

by:Reapz
ID: 10713685
And here's me thinking that because it's a "post"field the method was post by default....

Anyway that plus a little rearranging of the headers seems to have done the trick.

Cheers!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best Access Point Device 25 76
Auto channel for WiFi (Access Point) 3 109
Cisco 1811W VLAN configuration problem 3 42
Client lost connection to AP controlled by Cisco WLC2504 3 64
Coaxial cable bending There are several factors that govern the selection of coaxial cable for your Machine to Machine (M2M) application: the location of cable runs, either indoor or outdoor, inside or outside an enclosure, maximum bending and the…
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question