Html Form To Wml

Started on the old forum in September 2007 · view the original in the archive · old links redirect here

3 replies · 727 views · started 19 years ago · 1 min read

3 participants
thanatos Senior · 261 posts #1

can anyone help me on how to correct the changes i've made in this script..

this is the html file

<?PHP

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
echo "<html><head><title>PLAY LOTERY</title></head><body><center>";
$keno_numbers = array (
    "0" => "",
    "1" => "",
    "2" => "",
    "3" => "",
    "4" => "",
    "5" => "",
    "6" => "",
    "7" => "",
    "8" => "",
    "9" => "",
    "10" => "",
    "11" => "",
    "12" => "",
    "13" => "",
    "14" => "",
    "15" => "",
    "16" => "",
    "17" => "",
    "18" => "",
    "19" => "",
    "20" => "");
$player_numbers = array (
    "0" => "$n1",
    "1" => "$n2",
    "2" => "$n3",
    "3" => "$n4",
    "4" => "$n5",
    "5" => "$n6",
    "6" => "$n7",
    "7" => "$n8",
    "8" => "$n9",
    "9" => "$n10",
    "10" => "$n11",
    "11" => "$n12",
    "12" => "$n13",
    "13" => "$n14",
    "14" => "$n15",
    "15" => "$n16",
    "16" => "$n17",
    "17" => "$n18",
    "18" => "$n19",
    "19" => "$n20");

if ($action == "play")
{
    $i = 0;
    while ($i < 20)
    {
        $temp = rand(1,80);
        if (!in_array($temp,$keno_numbers))
        {
            $keno_numbers[$i] = $temp;
            $i++;
        }
    } 
    sort($keno_numbers);
    sort($player_numbers);
}
$i = 0;
$points = 0;
while ($i < 20)
{
    if (in_array($keno_numbers[$i],$player_numbers))
        $points++;
    $i++;
}
echo "<TABLE>";
$i = 0;
$n = 1;
while ($i < 8)
{
    if ($i % 2 == 1)
        echo "  <TR BGCOLOR=\"#C1C2F5\">";
    else
        echo "  <TR>";

    $j = 0;
    while ($j < 10)
    {

        if (in_array($n, $keno_numbers))
            echo "<TD BGCOLOR=\"#ECBCBC\">";
        else
            echo "<TD>";
        echo "<FONT FACE=\"verdana, arial, helvetica\" SIZE=2>";
        if (in_array ($n, $player_numbers))
            echo "[b]  $n  [/b]";
        else
            echo "  $n  ";
        echo "</FONT></TD>";
        $j++;
        $n++;
    }
    $i++;
}
echo "</TABLE>";

if ($action == "play")
{
    echo "[b](!) the winning numbers are:[/b]
";
    $w = 0;
    while ($w < 20)
    {
        echo "  $keno_numbers[$w]";
        $w++;
        if ($w % 10 == 0)
            echo "
";
    }
    echo "[b]and you selected:[/b]
";
    $w = 0;
    while ($w < 20)
    {
        echo "  $player_numbers[$w]";
        $w++;
        if ($w % 10 == 0)
            echo "
";
    }
    echo "[b](!) you found $points numbers.[/b]";
}
echo "<FORM METHOD=post ACTION=\"$PHP_SELF?action=play&". time(). "\">SELECT 20 NR. FROM 1 TO 80:
";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n1 VALUE=\"$player_numbers[0]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n2 VALUE=\"$player_numbers[1]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n3 VALUE=\"$player_numbers[2]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n4 VALUE=\"$player_numbers[3]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n5 VALUE=\"$player_numbers[4]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n6 VALUE=\"$player_numbers[5]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n7 VALUE=\"$player_numbers[6]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n8 VALUE=\"$player_numbers[7]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n9 VALUE=\"$player_numbers[8]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n10 VALUE=\"$player_numbers[9]\">
";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n11 VALUE=\"$player_numbers[10]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n12 VALUE=\"$player_numbers[11]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n13 VALUE=\"$player_numbers[12]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n14 VALUE=\"$player_numbers[13]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n15 VALUE=\"$player_numbers[14]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n16 VALUE=\"$player_numbers[15]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n17 VALUE=\"$player_numbers[16]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n18 VALUE=\"$player_numbers[17]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n19 VALUE=\"$player_numbers[18]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n20 VALUE=\"$player_numbers[19]\">
";
echo "<INPUT TYPE=submit VALUE=\"play lotery\"></FORM></center></body></html>";

?>

this is the changes i've made to make it wml..

<?php
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
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>

<?php

$keno_numbers = array (
    "0" => "",
    "1" => "",
    "2" => "",
    "3" => "",
    "4" => "",
    "5" => "",
    "6" => "",
    "7" => "",
    "8" => "",
    "9" => "",
    "10" => "",
    "11" => "",
    "12" => "",
    "13" => "",
    "14" => "",
    "15" => "",
    "16" => "",
    "17" => "",
    "18" => "",
    "19" => "",
    "20" => "");
$player_numbers = array (
    "0" => "$n1",
    "1" => "$n2",
    "2" => "$n3",
    "3" => "$n4",
    "4" => "$n5",
    "5" => "$n6",
    "6" => "$n7",
    "7" => "$n8",
    "8" => "$n9",
    "9" => "$n10",
    "10" => "$n11",
    "11" => "$n12",
    "12" => "$n13",
    "13" => "$n14",
    "14" => "$n15",
    "15" => "$n16",
    "16" => "$n17",
    "17" => "$n18",
    "18" => "$n19",
    "19" => "$n20");

if ($action == "play")
{
    $i = 0;
    while ($i < 20)
    {
        $temp = rand(1,80);
        if (!in_array($temp,$keno_numbers))
        {
            $keno_numbers[$i] = $temp;
            $i++;
        }
    } 
    sort($keno_numbers);
    sort($player_numbers);
}
$i = 0;
$points = 0;
while ($i < 20)
{
    if (in_array($keno_numbers[$i],$player_numbers))
        $points++;
    $i++;
}

echo "<card id=\"main\" title=\"WAP\">";
      echo "<p align=\"center\">";
echo " ";
$i = 0;
$n = 1;
while ($i < 8)
{
    if ($i % 2 == 1)
        echo "   ";
    else
        echo "   ";

    $j = 0;
    while ($j < 10)
    {

        if (in_array($n, $keno_numbers))
            echo " ";
        else
            echo " ";
        echo " ";
        if (in_array ($n, $player_numbers))
            echo "[b]  $n  [/b]";
        else
            echo "  $n  ";
        echo " ";
        $j++;
        $n++;
    }
    $i++;
}

echo " ";

if ($action == "play")
{
$player_numbers[0] = $_GET["player_numbers[0]"];
$player_numbers[1] = $_GET["player_numbers[1]"];
$player_numbers[2] = $_GET["player_numbers[2]"];
$player_numbers[3] = $_GET["player_numbers[3]"];
$player_numbers[4] = $_GET["player_numbers[4]"];
$player_numbers[5] = $_GET["player_numbers[5]"];
$player_numbers[6] = $_GET["player_numbers[6]"];
$player_numbers[7] = $_GET["player_numbers[7]"];
$player_numbers[8] = $_GET["player_numbers[8]"];
$player_numbers[9] = $_GET["player_numbers[9]"];
$player_numbers[10] = $_GET["player_numbers[10]"];
$player_numbers[11] = $_GET["player_numbers[11]"];
$player_numbers[12] = $_GET["player_numbers[12]"];
$player_numbers[13] = $_GET["player_numbers[13]"];
$player_numbers[14] = $_GET["player_numbers[14]"];
$player_numbers[15] = $_GET["player_numbers[15]"];
$player_numbers[16] = $_GET["player_numbers[16]"];
$player_numbers[17] = $_GET["player_numbers[17]"];
$player_numbers[18] = $_GET["player_numbers[18]"];
$player_numbers[19] = $_GET["player_numbers[19]"];
    echo "
[b](!) the winning numbers are:[/b]
";
    $w = 0;
    while ($w < 20)
    {
        echo "  $keno_numbers[$w]";
        $w++;
        if ($w % 10 == 0)
            echo "
";
    }
    echo "
[b]and you selected:[/b]
";
    $w = 0;
    while ($w < 20)
    {
        echo "  $player_numbers[$w]";
        $w++;
        if ($w % 10 == 0)
            echo "
";
    }
    echo "[b](!) you found $points numbers.[/b]";
}

echo "

SELECT 6 numbers FROM 1 TO 80:
";
echo "<input name=\"player_numbers[0]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[1]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[2]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[3]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[4]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[5]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[6]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[7]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[8]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[9]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[10]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[11]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[12]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[13]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[14]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[15]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[16]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[17]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[18]\" maxlength=\"2\"/> ";
echo "<input name=\"player_numbers[19]\" maxlength=\"2\"/>
";
 echo "<anchor>Play";
        echo "<go href=\"$PHP_SELF?action=play&". time(). "\" method=\"post\">";
        echo "<postfield name=\"player_numbers[0]\" value=\"$(player_numbers[0])\"/>";
        echo "<postfield name=\"player_numbers[1]\" value=\"$(player_numbers[1])\"/>";
        echo "<postfield name=\"player_numbers[2]\" value=\"$(player_numbers[2])\"/>";
        echo "<postfield name=\"player_numbers[3]\" value=\"$(player_numbers[3])\"/>";
        echo "<postfield name=\"player_numbers[4]\" value=\"$(player_numbers[4])\"/>";
        echo "<postfield name=\"player_numbers[5]\" value=\"$(player_numbers[5])\"/>";
        echo "<postfield name=\"player_numbers[6]\" value=\"$(player_numbers[6])\"/>";
        echo "<postfield name=\"player_numbers[7]\" value=\"$(player_numbers[7])\"/>";
        echo "<postfield name=\"player_numbers[8]\" value=\"$(player_numbers[8])\"/>";
        echo "<postfield name=\"player_numbers[9]\" value=\"$(player_numbers[9])\"/>";
        echo "<postfield name=\"player_numbers[10]\" value=\"$(player_numbers[10])\"/>";
        echo "<postfield name=\"player_numbers[11]\" value=\"$(player_numbers[11])\"/>";
        echo "<postfield name=\"player_numbers[12]\" value=\"$(player_numbers[12])\"/>";
        echo "<postfield name=\"player_numbers[13]\" value=\"$(player_numbers[13])\"/>";
        echo "<postfield name=\"player_numbers[14]\" value=\"$(player_numbers[14])\"/>";
        echo "<postfield name=\"player_numbers[15]\" value=\"$(player_numbers[15])\"/>";
        echo "<postfield name=\"player_numbers[16]\" value=\"$(player_numbers[16])\"/>";
        echo "<postfield name=\"player_numbers[17]\" value=\"$(player_numbers[17])\"/>";
        echo "<postfield name=\"player_numbers[18]\" value=\"$(player_numbers[18])\"/>";
        echo "<postfield name=\"player_numbers[19]\" value=\"$(player_numbers[19])\"/>";
        echo "</go></anchor>
";
 echo "</p></card>";

?>

</wml>

my problem with this is that the numbers in inputs doesnt show.. i have a little knowledge on php.. can someone help me fix this thing??? and please explain.. i also wanna shorten the numbers from 1 to 80 to 1 - 5 or 6 only.. how is this done?? thanks.. i'd be much wanting to learn from this stuff.. External image (may be gone) thanks.. External image (may be gone)

thanatos Senior · 261 posts #3

THATS BECAUSE YOU NEED A DATABASE TO SAVE THE NUM,BERS IN THEN IT SHOULD WORK FYN

but the script work fine on the html format.. it doesnt require sql tables.. see the html format.. the only problem is the changes in the html form of the script because i want it to be in wml format..

have an eye on inputs and postfield variables that i've change to make it wml.. what's wrong with it???

anyone who's expert on this? please explain it well.. tnx..

Ricky21ster Developer · 139 posts #4

here echo "

SELECT 6 numbers FROM 1 TO 80: "; echo "<form action="$PHP_SELF?action=play&". time(). "" method="post">"; echo "<input name="player_numbers[0]" maxlength="2"/> "; echo "<input name="player_numbers[1]" maxlength="2"/> "; echo "<input name="player_numbers[2]" maxlength="2"/> "; echo "<input name="player_numbers[3]" maxlength="2"/> "; echo "<input name="player_numbers[4]" maxlength="2"/> "; echo "<input name="player_numbers[5]" maxlength="2"/> "; echo "<input name="player_numbers[6]" maxlength="2"/> "; echo "<input name="player_numbers[7]" maxlength="2"/> "; echo "<input name="player_numbers[8]" maxlength="2"/> "; echo "<input name="player_numbers[9]" maxlength="2"/> "; echo "<input name="player_numbers[10]" maxlength="2"/> "; echo "<input name="player_numbers[11]" maxlength="2"/> "; echo "<input name="player_numbers[12]" maxlength="2"/> "; echo "<input name="player_numbers[13]" maxlength="2"/> "; echo "<input name="player_numbers[14]" maxlength="2"/> "; echo "<input name="player_numbers[15]" maxlength="2"/> "; echo "<input name="player_numbers[16]" maxlength="2"/> "; echo "<input name="player_numbers[17]" maxlength="2"/> "; echo "<input name="player_numbers[18]" maxlength="2"/> "; echo "<input name="player_numbers[19]" maxlength="2"/> ";

   echo "<input type=\"submit\" value=\"post\"/>";

echo "</form>";

echo "</html>";

?>

get cheap web hosting ever AdzeHost

get free hosting for life time hostwebswap not allowed

get free cpanel web hosting free cpanel hostingwap are allowed

External image (may be gone)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close