/    Sign up×
Community /Pin to ProfileBookmark

[CODE]<form action=”sayi.php” method=”post”>

input a number between 1-99:

<input name=”number” type=”text” id=”sayi”>
<input name=”ok” type=”submit” value=”ok”>

</form>

<?php

$A = $_REQUEST[“number”];
$B = $_REQUEST[“number”];

echo (“number “);

if ($A<10) $B=$A;

else if ($A>=10 && $A<20) { $B=$A-10; echo(“ten “);}
else if ($A>=20 && $A<30) { $B=$A-20; echo(“twenty “);}
else if ($A>=30 && $A<40) { $B=$A-30; echo(“thirty “);}
else if ($A>=40 && $A<50) { $B=$A-40; echo(“fourty “);}
else if ($A>=50 && $A<60) { $B=$A-50; echo(“fifty “);}
else if ($A>=60 && $A<70) { $B=$A-60; echo(“sixty “);}
else if ($A>=70 && $A<80) { $B=$A-70; echo(“seventy “);}
else if ($A>=80 && $A<90) { $B=$A-80; echo(“eighty “);}
else if ($A>=90 && $A<100){ $B=$A-90; echo(“ninety “);}

if ($B==1) echo(“one”);

else if ($B==2) echo(“two”);
else if ($B==3) echo(“three”);
else if ($B==4) echo(“four”);
else if ($B==5) echo(“five”);
else if ($B==6) echo(“six”);
else if ($B==7) echo(“seven”);
else if ($B==8) echo(“eight”);
else if ($B==9) echo(“nine”);

if ($A >= 100 || $A <= 0 )
{
echo “only must be between 1-99!”;
}

?>
[/CODE]

When I have these codes run,I am getting these errors.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@scragarApr 21.2007 — [code=php]<form action="sayi.php" method="post">
input a number between 1-99:

<input name="number" type="text" id="sayi">
<input name="ok" type="submit" value="ok">

</form>
<?php
$tens = array("ten", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety");

$units = array("one", "two", "thee", "four", "five",
"six", "seven", "eight", "nine");

$A = $_REQUEST["number"];
$B = substr($A, 1);
$A = substr($A, 0, 1);
echo ("number ".$tens[$A]." ".$units[$B]);

if ($_REQUEST["number"] >= 100 || $_REQUEST["number"] <= 0 ){
echo "only must be between 1 and 99!";
};

?>

[/code]

fixed and improved.
×

Success!

Help @OPETH spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...