Jump to content

Archived

This topic is now archived and is closed to further replies.

HFD

Not Echoing Anything When It Should...

Recommended Posts

Hey guys, I have made a script that translates between fictional language Al Bhed, and English. This used to work perfectly and I didn't run into any problems at all. However, now when I type in the phrase I want to translate and click Submit, the translated phrase doesn't appear. You can see what I mean by going to [a href=\"http://www.fflibrary.co.uk/ffx/albhedtranslator.php\" target=\"_blank\"]http://www.fflibrary.co.uk/ffx/albhedtranslator.php[/a]

Here is my code

[code]
<?php

$game = 'FFX';
$title = 'Al Bhed Translator';
include ("../header.php");

echo '<center><h1>English to Al Bhed</h1> <br /><br />';
echo '<form method="get">
Enter the phrase you want converted: <input type="text" name="albhed">
<input type="submit" value="Submit">
</form>';

$albhedlang = array("a" => "y", "b" => "p", "c" => "l", "d" => "t", "e" => "a", "f" => "v", "g" => "k", "h" => "r", "i" => "e", "j" => "z", "k" =>"g", "l" => "m", "m" => "s", "n" => "h", "o" => "u", "p" => "b", "q" => "x", "r" => "n", "s" => "c", "t" => "d", "u" => "i", "v" => "j", "w" => "f", "x"=>"q", "y" => "o", "z" => "w", "A" => "Y", "B" => "P", "C" => "L", "D" => "T", "E" => "A", "F" => "V", "G" => "K", "H" => "R", "I" => "E", "J" => "Z", "K" =>"G", "L" => "M", "M" => "S", "N" => "H", "O" => "U", "P" => "B", "Q" => "X", "R" => "N", "S" => "C", "T" => "D", "U" => "I", "V" => "J", "W" => "F", "X"=>"Q", "Y" => "O", "Z" => "W");

$albhed = stripcslashes($albhed);

echo '<div width="100%" style="border: 1px solid black; background-color: #FFFFFF;">';
echo strtr($albhed,$albhedlang);
echo '</div>';

echo '<br /><br /><h1>Al Bhed to English</h1> <br /><br />';
echo '<form method="get">
Enter the phrase you want converted: <input type="text" name="albhed2">
<input type="submit" value="Submit">
</form>

';

$albhedlang2 = array("y" => "a", "p" => "b", "l" => "c", "t" => "d", "a" => "e", "v" => "f", "k" => "g", "r" => "h", "e" => "i", "z" => "j", "g" =>"k", "m" => "l", "s" => "m", "h" => "n", "u" => "o", "b" => "p", "x" => "q", "n" => "r", "c" => "s", "d" => "t", "i" => "u", "j" => "v", "f" => "w", "q"=>"x", "o" => "y", "w" => "z", "Y" => "A", "P" => "B", "L" => "C", "T" => "D", "A" => "E", "V" => "F", "K" => "G", "R" => "H", "E" => "I", "Z" => "J", "G" =>"K", "M" => "L", "S" => "M", "H" => "N", "U" => "O", "B" => "P",  "X" => "Q", "N" => "R", "C" => "S", "D" => "T", "I" => "U", "J" => "V", "F" => "W", "Q"=>"X", "O" => "Y", "W" => "Z",);

$albhed2 = stripcslashes($albhed2);

echo '<div width="100%" style="border: 1px solid black; background-color: #FFFFFF;">';
echo strtr($albhed2,$albhedlang2);
echo '</div></center>';

include("../footer.php");

?>
[/code]

Can anybody help? :(

Share this post


Link to post
Share on other sites
Change:
stripcslashes($albhed])
to:
stripcslashes($_GET['albhed'])

And chnage:
stripcslashes($albhed]2)
to:
stripcslashes($_GET['albhed2'])

Share this post


Link to post
Share on other sites
The problem is you aren't getting the data from the form. So where you say...

$albhed = stripcslashes($albhed); // $albhed = null...

So try...
$albhed = stripcslashes($_GET['albhed']); // this worked for me


Also remember to do this for the reverse translation.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.