|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Need Help With HTML conversion
Hi there guys, im new to the boards. Theres some really good info here thanks for having a forum on WAP, theres still life in it yet! Anyways im having trouble converting a HTML/PHP script 2 wml. Im creating a tourist information site and also doing a wap version.The php scripts works perfectly im having trouble with the code syntax. Im new to WML so speak in english please. I changed a few of the printf statements 2 echo. Is there anywhere i can learn about creating an update form for my wap site so a user can add details into my database e.g there house or retaurant?
PHP Code:
accomadation.php
PHP Code:
search1result.php
Last edited by jabba_29 : April 23rd, 2006 at 08:31 PM. Reason: Put code into highlight tags |
|
#2
|
||||
|
||||
|
Hi, Welcome to Dev Shed.
A few things to note. WML is based on xml, so the syntax / mark-up needs to be absolutely correct or is just won't display on a mobile device. This means that tags need to be in lower case and properly nested. So, this is wrong for example. PHP Code:
PHP Code:
Take a look at the wap resources sticky, there are a couple of excellent sites to learn the mark-up required. Forms in wml are a bit different than in html. Build your form, and make postfields accordingly. Good luck.
__________________
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
|
|||||
|
|||||
|
Ok thanks for that. Im starting to build my form from scratch again. so far ive used all the basics. Is my form action right though? Now to query my database. When writing php SQL commands in is there many changes to be made? for example i want to insert the HTML PHP SQL query into my wml script so it brings a dropdown list off all towns in the area...
sql query for towns php Code:
Mod comment: Please use the BBcode tags provided, PHP Code:
Last edited by jabba_29 : April 24th, 2006 at 08:15 AM. Reason: Code tags again |
|
#4
|
||||
|
||||
|
Quote:
You also have no DTD and are not, visibly at least forcing the content-type. Here is a little demo, maybe help you a little. PHP Code:
wml.php
|
|
#5
|
|||
|
|||
|
Hi again, thanks for the help its very useful.I apologise for being a newbie,i havent developed WML before. I tried inputting the postfield tags earlier but it wasnt displaying properly. I was told that i didnt need the content header as ive some othe wml pages using php tags which works fine without them e.g echo time etc. The options are now in place and all names are apperaing correcty. I would prefer if it was displaying in a dropdown list as opposed to a long list on the screen.. There is no submit button apperaing under the option table so it wont display results?
Code:
accomadation.php
<?php
header('Content-Type: text/vnd.wap.wml, true');
echo '<?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>
<card id="Accomadation" title="Accomadation">
<p align="left">
<?php
// connect to mysql database
require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = mysql_connect($db_host, $db_user, $db_password) or die("error connecting");
mysql_select_db($db_name, $connection);
?>
<?php
if (isset($_POST['prem_type'])):
print_r($_POST);
else:
?>
<br>
<b>Please Select</b>
<b>From the following Accomadation options.</b>
</p>
<select name = 'prem_type'>
<option value ="0">Select Premises Type</option>
<?
$query = "SELECT * FROM premises_type";
$result = mysql_query($query, $connection);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$prem_type = mysql_result($result, $i,"prem_type");
$prem_type_id1 = mysql_result($result, $i,"prem_type_id");
if ($prem_type_id == $prem_type_id1)
{
printf("\n<option selected value =%s>%s</option>",$prem_type_id,$prem_type);
}
else printf("\n<option value =%s>%s</option>",$prem_type_id1,$prem_type);
}
?>
</select><br>
</select>
<select name = 'town'>
<option value ="0">Select Town</option>
<?
$query = "SELECT * FROM town";
$result = mysql_query($query, $connection);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$town_name = mysql_result($result, $i, "town_name");
$town_id = mysql_result($result, $i, "town_id");
printf("\n<option value =%s>%s</option>",$town_id,$town_name);
}
?>
</select></select><br>
<do type="accept">
<go href="result.php" method="post">
<postfield name="town" value="$(town)"/>
<postfield name="prem_type" value="$(prem_type)"/>
</go>
</do>
</p>
<p align="center">
<a href="home.php">Back</a>
<?php
endif;
?>
</p>
</card>
</wml>
|
|
#6
|
|||
|
|||
|
I have results now displaying on the screen. thanks for all your help
![]() |
|
#7
|
||||
|
||||
|
What are you viewing this in? On a phone or in a web browser? Not gone over your code completely, but <br> must be <br /> or <br/>. Also, PHP Code:
snippet
This may or may not help you, but I am in a good mood today ![]() |