Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WAP noob needs help passing variables to PHP!

Posted on 2004-03-29
5
Medium Priority
?
566 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
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

Lessons on Wi-Fi & Recommendations on KRACK

Simplicity and security can be a difficult  balance for any business to tackle. Join us on December 6th for a look at your company's biggest security gap. We will also address the most recent attack, "KRACK" and provide recommendations on how to secure your Wi-Fi network today!

Question has a verified solution.

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

Today sees the launch of a new case study, focusing on BYOD technologies we have been working with for some time now.  But with the advent of 802.11ac wireless technologies and the story behind our landmark developments, we would like to share this …
DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
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…
Suggested Courses

927 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