Jump to content

Recommended Posts

hey guys

im currently trying to make a trans lator

i have all the code set up

but when it posts the code

it doesn't put it in the textarea

it puts it in the top left corner

here is the code

<?

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("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);

	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("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);

	echo $str;
}

$submit_org = $_POST['regular'];
$submit_eng = $_POST['translate'];
$msg = "";
if ($submit_org) {
$english = original($_POST['original']);	
echo '
<center>
<form method="POST">
<table>
<tr>
<td>
<textarea cols="30" rows="10" name="original"></textarea><br>
<input type="submit" name="regular" value="Translate >>">
</td><td>
<textarea cols="30" rows="10" name="translated"></textarea><br>
<input type="submit" name="translate" value="<< Translate"></td>
</tr></table>
</form>
';

} else if ($submit_eng) {
$english = $_POST['english'];
$original = from_english($_POST['translated']);
echo '
<center>
<form method="POST">
<table>
<tr>
<td>
<textarea cols="30" rows="10" name="original">{$origanal}</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>
';
} else {
echo '
<center>
<form method="POST">
<table>
<tr>
<td>
<textarea cols="30" rows="10" name="original"></textarea><br>
<input type="submit" name="regular" value="Translate >>">
</td><td>
<textarea cols="30" rows="10" name="translated"></textarea><br>
<input type="submit" name="translate" value="<< Translate"></td>
</tr></table>
</form>
';

}
?>

what i want it too do is display the translated text in the right text box if its from the left one

and vice versa

 

any help??

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/54639-solved-simple-translator-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.