|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing data to PHP from a .xhtml file
I'm trying to send input data to a PHP file
from an .xhtml file .xhtml file Code:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Welcome to W@PSiTe</title> </head> <body> <p>Welcome to W@PSiTe Mobile Service!<br/></p> <form method="POST" action="loginwap.php"> <p> Email : <input type="text" name="email" /> Password : <input type="password" name="password" /> <input type="submit" name="login_btn" value="Send Data" /> </p> </form> </body> </html> .php file Code:
<?php
// send wml headers
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.dtd\">";
?>
if(isset($_POST['submit'])) {
$pwd = md5($_POST['password']);
$email = $_POST['username'];
$sel_q = "select * from the_table where the_email = '$email' and the_pwd='$pwd' limit 1";
$sel_r = mysql_query ($sel_r);
$sel_c = mysql_num_rows($sel_r);
if ($sel_c > 0) {
echo "<p>OK!</p>";
} else {
echo "<p>NOT OK!</p>";
}
} else {
echo "<p>Wrong password!</p>";
}
I'm using "SmartPhone Emulator 6" as my emulator. the .xhtml is ok but when sent to the PHP file it shows "502 error" or "Error : 502 - No gateway Reply" Am I doing it correctly? I'm really new to WAP and all things about wireless. Any input is very much appreciated. thanks in advance.
__________________
*** today i ask, tomorrow i help - sandbag |
|
#2
|
|||||
|
|||||
|
Hi there, glad you found the wap forums at last
![]() When you are sending wap headers, the outputed xhtml has to be correct or you will get nothing back.... Personally, for xhtml I send the headers as application/vnd.wap.xhtml+xml if the phone can handle it... Anyhow, you should make sure you have the full page in the .xhtml file, you currently don't in your snippet at least... php Code:
__________________
Cheers, Jamie # mdb4u | mobile movie database] | Please help to test and promote # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure __________________ 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
|
|||
|
|||
|
hello:
haha, yeah...finally found the WAP forum. thanks for the reply jabba. i still get an error : "Reply Unknown" here's my php code for now. (*for debugging) .php file Code:
<?php
header("Content-type: text/vnd.wap.wml, true");
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Processing login to W@PSiTe</title>
</head>
<body>
<p>Welcome to W@PSiTe!</p>
<?php
echo '<div><pre>';print_r($_POST);
echo '</pre></div>';
?>
</body>
</html>
and my .xhtml file (all of it) Code:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>xhtml file</title> </head> <body> <p>Welcome to W@PSiTe Mobile Service!<br/></p> <form method="POST" action="loginwap.php"> <p> Email :<br/> <input type="text" name="email" /> Password :<br/> <input type="password" name="password" /> <input type="submit" value="Send Data" name="login_btn" /> </p> </form> </body> </html> did I miss anything on one of the files? thanks again. Last edited by bulletz : October 9th, 2006 at 11:47 PM. |
|
#4
|
|||
|
|||
|
I finally got it to work!
ok... now for the next step.... ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Mobile Programming > Passing data to PHP from a .xhtml file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|