Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WAP noob needs help passing variables to PHP!

Posted on 2004-03-29
5
Medium Priority
?
564 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:Andy
[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:Andy
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 1000 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:Andy
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

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

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

Hopefully this article will help someone who's had the same issues I had. I have a Dell Wireless 1390 WLAN Mini-Card and Windows 7, and for the past couple of days I was beyond frustrated because my wireless laptop was not able to access the Inte…
With the purchase of CloudCommand by Comcast customers are left in a bind as subscriptions expire and render the AP's disabled. The following will explain how to flash your Ubiquiti AP's with CloudCommand firmware back to Ubiquiti firmware. HOWTO…
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…

730 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