SunQuest
           WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 25th, 2005, 06:07 AM
fr_cassidy fr_cassidy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 11 fr_cassidy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 50 m 18 sec
Reputation Power: 0
Tying to send data from WML to PHP using post...

Hello Everyone,

I am currently trying to develop an application using wml and php to view the latest weather conditons at a home weather station.

I am having difficulty trying to send a variable (the date for the query) to a php script so that it can query the mytsql database for the relevant data. I am including snippets of the scripts that I have written. I think I may be doing something very basic wrong.


WML Snippet:
<card id="other" title="Choose Date">

<p align=center>

Enter Query Date (YYYY/MM/DD):

<input format="NNNN\/NN\/NN" name="query_date"/>

<do type="accept" name="next" label="Query">
<go href="parsewmltest.php" method="post">
<postfield name="date" value="$(date)"//>
</go>
</do>

</p>


PHP Snippet:
<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>

<wml>

<card id="Query" title="Archive">

<p align="center">

<?php
$date=$_POST['date'];
echo"$date";
?>

<br/>
<u>Select Time Period</u>

Parsing

</p>
</card>

</wml>


Also, I am using the openwave simulator and an apache web server

Thanks for any help,
fr

Reply With Quote
  #2  
Old February 25th, 2005, 07:12 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 10 m 50 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Code:
 <do type="accept" name="next" label="Query">
<go href="parsewmltest.php" method="post">
<postfield name="query_date" value="$(query_date)"/>
</go>
</do>

When debugging post vars, try this snippet - it shows what has been submitted.
Code:
<pre>
<?php
print_r($_POST);  
?>
</pre>
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Reply With Quote
  #3  
Old February 25th, 2005, 07:22 AM
fr_cassidy fr_cassidy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 11 fr_cassidy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 50 m 18 sec
Reputation Power: 0
Thanks for the reply jabba,

I tired what snippet and I got the following displayed on the phone sim at the other side...

Array
(
[date] =>

)

I'm not too sure what this means. is it just an empty varibale called date??

fr

Reply With Quote
  #4  
Old February 25th, 2005, 08:34 AM
fr_cassidy fr_cassidy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 11 fr_cassidy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 50 m 18 sec
Reputation Power: 0
When I choose to view the source on the phone simulator the first and last tags are html tags. Shoudn't they be wml?

I have not made any configuration changes to the apaches web server in the config file. I was doing a bit a reading on the net about it a couple of days ago. I got some text to paste in the last day but it made no difference to this.

The text I pasted in was:

AddType application/x-httpd-php .wml

just under where php addtype is. Was this the correct place to do it or have i pasted the wrong thing. I have since commented it out, but it seemed to make no difference when it was there.

I had a simple php script written to query the mysql database directly and return some results. this works fine even though no configuration changes were made to the config file.

Does anyone know how to make the correct configuration changes to the server? or is this the root cause of the problem?

I am using:
Apache Web Server Version 1.3.33
PHP Script Language Version 4.3.10

Thanks for any help.
fr

Reply With Quote
  #5  
Old February 25th, 2005, 11:54 PM
Gi812 Gi812 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 Gi812 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 2 m 23 sec
Reputation Power: 0
Am I missing something... Should this line

<postfield name="date" value="$(date)//

be

<postfield name="date" value="$(query_date)"//>

Reply With Quote
  #6  
Old February 26th, 2005, 01:07 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 10 m 50 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Yes it should - I posted that in my response.

Reply With Quote
  #7  
Old February 26th, 2005, 01:46 PM
fr_cassidy fr_cassidy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 11 fr_cassidy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 50 m 18 sec
Reputation Power: 0
Ok its working! but I'm not sure why.

Jabba, i misread your first reply but changed the code as you recommended and it worked so thanks for that.

Could you please tell me why your code worked and mine didn't?
I had altered my code and tried a couple of different things before you replied and the only difference that i could see was this line

<postfield name="query_date" value="$(query_date)"/>

Also could someone please advise me if this application would worked straight away on an ordinary WAP enabled mobile phone without any configuration changes on the apache web server to tell it to parse the PHP and output WML?

Currently I am just testing these scripts on the openwave simulator with no configuration changes on apache.

Thanks for all your help so far

fr

Reply With Quote
  #8  
Old February 27th, 2005, 11:59 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 10 m 50 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
To answer the first question, it is becuase your input box was named query_date, so that has to match the postfield name.
With regards to setting up apache, I have done no configurations at all to mine, and wml is fine on it - admittedly, I use PHP most of the time and force it to be wml, but I am pretty sure I have .wml files processed as wml correctly.

Reply With Quote
  #9  
Old April 2nd, 2005, 05:13 AM
POC POC is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 25 POC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 18 m 41 sec
Reputation Power: 0
similar problem

I have a very similar problem its a login page and i need two variables sent here is my code:

<wml>
<card id="Login" title="Login">

User : <input name="loginuser" type="text"/>
<br/>
Password: <input name="loginPw" type="loginpw"/>
<br/><br/>


<center>
<do type="accept" label="Enter" >
<go href="check.wml"method="post">
<postfield name="loginuser" value="$(loginuser)"//>
<postfield name="loginpw" value="$(loginpw)"//>

is that right? and what code would i use to make it equal to something in my php code?

Reply With Quote
  #10  
Old April 2nd, 2005, 06:59 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 10 m 50 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Something like this maybe:
Code:
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<!-- THIS IS THE LOGIN CARD -->
<card id="login" title="Login">
<p> 
<do type="accept" label="Enter">
<go href="check.php" method="post"> 
<postfield name="loginuser" value="$loginuser" /> 
<postfield name="loginpw" value="$loginpw" /> 
</go> 
</do> 
</p>

<p>
User Name: <input title="loginuser" name="loginuser" /> <br /> 
Password : <input title="password" name="loginpw" type="loginpw" /> <br />
</p> 
</card>

</wml>

PHP Code:
<?php
// check.php
if (isset($_POST['loginuser'])):
    
// do query where your vars are $_POST['loginuser'] & $_POST['loginpw']
    
if ($query_was_successful):
    
// maybe start a session here
    
$message 'You are now logged in';
    else:
    
$message 'Username / password not found';
    endif;
else:
    
// form was partially empty / not submitted
    
$message 'form was partially empty / not submitted';
endif;

header('Content-Type: text/vnd.wap.wml'true); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Pragma: no-cache");
print 
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<!-- THIS IS THE PROCESS CARD -->
<card id="process" title="Processing">

<p>
<?php echo $message?>
</p> 
</card>

</wml>

Reply With Quote
  #11  
Old April 2nd, 2005, 07:38 AM
POC POC is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 25 POC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 18 m 41 sec
Reputation Power: 0
cheers i got it working all i need to know is how to use variables $_POST['loginuser'] thanks for that

Reply With Quote
  #12  
Old April 9th, 2005, 01:46 PM
dannyh21 dannyh21 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 11 dannyh21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 37 sec
Reputation Power: 0
I am having a similar sort of problem to this. I am trying to post a variable to be used on the following page by a java bean to send an email. I have the code

Code:
<p>To:
<input type="text" name="to"></p>
<do type="accept" label="Ok">
<go href="mailer.jsp" method="post">
<postfield name="to" value="$(to)"/>
</go>
</do>


and on the next page I have the code

Code:
<jsp:setProperty name="mailer" property="to" value="$(to)" />


Can anyone see any reason this is not working?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > Tying to send data from WML to PHP using post...


Thread Tools  Search this Thread