|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. __________________ |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Am I missing something... Should this line
<postfield name="date" value="$(date)// be <postfield name="date" value="$(query_date)"//> |
|
#6
|
||||
|
||||
|
Yes it should - I posted that in my response.
|
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||
|
||||
|
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. |
|
#9
|
|||
|
|||
|
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? |
|
#10
|
||||
|
||||
|
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:
|
|
#11
|
|||
|
|||
|
cheers i got it working all i need to know is how to use variables $_POST['loginuser'] thanks for that
|
|
#12
|
|||
|
|||
|
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? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > Tying to send data from WML to PHP using post... |
| Thread Tools | Search this Thread |