quickstopman Posted June 7, 2007 Share Posted June 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/54639-solved-simple-translator-help/ Share on other sites More sharing options...
chigley Posted June 7, 2007 Share Posted June 7, 2007 You're using single quotes in your echos but then you put a variable straight into it..... Quote Link to comment https://forums.phpfreaks.com/topic/54639-solved-simple-translator-help/#findComment-270202 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.