Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile 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:
  #1  
Old July 22nd, 2003, 12:53 PM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 8
WML variables problem

Hi there, i've had a good look through these forums and have found nothing that helped, so i thought it was time to post the question myself.

According to W3 (http://www.w3schools.com/wap/wml_variables.asp)
To gain access to a variable passed by a form you need to use lets say: $(name)

This proves a bit of a problem for me seeing as i'm wanting to use those variables to login and insert something into my database.

In order for me to gain access to those vars, i've tried:

$newvar = '$(name)';

Now the above works when you echo or print something, but when you want to pass the variable over to to an SQL query it seems to use the value as: $(name)

Is there anyone out there who can suggest a better way for me to collect the variables being passed when a form is filled out on a WAP site?

Thanks for any help.

David
__________________
-----
Do you fear the obsolescence of the metanarrative apparatus of legitimation?

Reply With Quote
  #2  
Old July 22nd, 2003, 02:45 PM
omiossec omiossec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Paris, France
Posts: 375 omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 16 h 4 m 46 sec
Reputation Power: 6
Send a message via ICQ to omiossec Send a message via AIM to omiossec
which tools did you use to connect to the database
__________________
Olivier Miossec
http://www.lasso-developpeur.net

Reply With Quote
  #3  
Old July 22nd, 2003, 04:30 PM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 8
Well i'm using PHP for the output of WML headers to falsify a .wml page.

So i guess the answer is PHP (mysql_connect and such)

David

Reply With Quote
  #4  
Old July 22nd, 2003, 11:02 PM
oskar oskar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: Copenhagen, DK
Posts: 222 oskar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 40 sec
Reputation Power: 8
Send a message via ICQ to oskar
This works for me (I've just tried it!) :O)

<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="main" title="Log ind">
<p>
Username:
<br />
<input title="user" name="username" />
Password:
<br /><input title="pass" name="password" type="password" />
<anchor>
Login
<go href="check.wml" method="post">
<postfield name="username" value="$(username)"/>
<postfield name="password" value="$(password)"/>
</go>
</anchor>
</p>
</card>
</wml>

And check.wml:

<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="varcheck" title="VARS">
<p>
<?php
if(isset($_POST["username"])) {
echo $_POST["username"];
$name = 1;
}
echo"<br/>";

if(isset($_POST["password"])) {
echo $_POST["password"];
$pass = 1;
}
echo"<br/>";

if(isset($name) && isset($pass)) {
$db = @mysql_connect("localhost", "stefnik", "****da") or die ("Kunne desværre ikke forbinde til databasen!");
mysql_select_db("wapworld", $db) or die ("Kunne desværre ikke forbinde valgte database!");
$dumping = mysql_query("INSERT INTO `testing` (`name`, `password`) VALUES ('$_POST[username]', md5('$_POST[password]'))") or die (mysql_error());
if($dumping) {
echo"Succes!";
}
}
?>
</p>
</card>
</wml>

And dump for DB:

CREATE TABLE testing (
id tinyint(3) NOT NULL auto_increment,
name varchar(16) NOT NULL default '',
password varchar(32) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;

Reply With Quote
  #5  
Old July 23rd, 2003, 07:10 AM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 8
I must thank you very much
That's what i need to know, how to get the WML variables registered as PHP $_POST variables.

This works a treat now.
Thanks.

David

Reply With Quote
  #6  
Old September 10th, 2007, 03:57 AM
Niha Niha is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 Niha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 30 sec
Reputation Power: 0
HI there,
I am using xampp server and havign hard time interpreting the code!!! when i eliminate the echo part : xml version....

it is interpreted but no variables passing!!! any idea?? what server are u using

thanks

Niha

Reply With Quote
  #7  
Old September 10th, 2007, 07:34 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,788 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 6 Days 14 h 2 m 31 sec
Reputation Power: 1640
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
Hi Niha,

Welcome to DS. Oh wait....
You waited 4 years to post your first comment

Please don't bump old threads

Can you explain exactly what your problem is and post relevant code snippets?
__________________
Cheers,

Jamie

# mdb4u | The 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.



__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > WML variables problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway