Jump to content

simple translator problem


quickstopman

Recommended Posts

im currently trying to make a simple translator that converts stuff

but the problem is

when you click on the button to translate it doesn't appear in the other <textarea>

can someone figure out what is wrong

<?

function from_english($str) {
	$str = str_replace("'eh", "hey", $str);
	$str = str_replace("'ello", "hello", $str);
	$str = str_replace("tea time", "coffee break", $str);
	$str = str_replace("govna", "governer", $str);
	$str = str_replace("fag", "cigarette", $str);
	$str = str_replace("fish and chips", "lunch", $str);
	$str = str_replace("ducky", "kid", $str);
	$str = str_replace("tea", "coffee", $str);
	$str = str_replace("gay", "ed", $str);
	$str = str_replace("stupid emo slut whore", "emmy", $str);
	$str = str_replace("bloke", "stupid person", $str);
	$str = str_replace("lawt","stuff", $str);
	$str = str_replace("go to the brighton pier", "have fun", $str);
	$str = str_replace("all of england and parts of whales suck", "england sucks", $str);
	$str = str_replace("americans are stupid", "america rocks", $str);
	$str = str_replace("sexy beast", "zack", $str);
	$str = str_replace("hawt", "hot", $str);
	$str = str_replace("got piss taken from", "annoyed", $str);
	$str = str_replace("satanic device of the jewish empire! :DD jk jk", "bagle", $str);

	echo $str;
}

function original($str) {
	$str = str_replace("hey", "'eh", $str);
	$str = str_replace("hello", "'ello", $str);
	$str = str_replace("coffee break", "tea time", $str);
	$str = str_replace("governer", "govna", $str);
	$str = str_replace("cigarette", "fag", $str);
	$str = str_replace("lunch", "fish and chips", $str);
	$str = str_replace("kid", "ducky", $str);
	$str = str_replace("coffee", " tea", $str);
	$str = str_replace("ed", "gay", $str);
	$str = str_replace("emmy", "stupid emo slut whore", $str);
	$str = str_replace("stupid person", "bloke", $str);
	$str = str_replace("stuff", "lawt", $str);
	$str = str_replace("have fun", "go to the brighton pier", $str);
	$str = str_replace("england sucks", "all of england and parts of whales suck", $str);
	$str = str_replace("america rocks", "americans are stupid", $str);
	$str = str_replace("zack", "sexy beast", $str);
	$str = str_replace("hot", "hawt", $str);
	$str = str_replace("annoyed", "got piss taken from", $str);
	$str = str_replace("bagle", "satanic device of the jewish empire! :DD jk jk", $str);

	echo $str;
}

$submit_org = $_POST['regular'];
$submit_eng = $_POST['translate'];
if ($submit_org) {
$english = original($_POST['original']);	
echo $english;
} else { /*
if ($submit_eng) {

$original = from_english($_POST['translated']);
*/
echo '
<form method="POST" action="translator.php">
<table>
<tr>
<td>
<textarea cols="30" rows="10" name="original">'. $original .'</textarea><br>
<input type="submit" name="regular" value="Translate >>">
</td><td>
<textarea cols="30" rows="10" name="translated">'. $english .'</textarea><br>
<input type="submit" name="translate" value="<< Translate"></td>
</tr></table>
</form>
';
}
?>

* note the /*'s are there because thats an unfinished part of the script

Link to comment
https://forums.phpfreaks.com/topic/53814-simple-translator-problem/
Share on other sites

Archived

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

×
×
  • Create New...

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.