quickstopman Posted June 1, 2007 Share Posted June 1, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/53814-simple-translator-problem/ Share on other sites More sharing options...
btherl Posted June 1, 2007 Share Posted June 1, 2007 Do you mean that $english is not appearing in the second text area? Does it echo where you have "echo $english" ? Quote Link to comment https://forums.phpfreaks.com/topic/53814-simple-translator-problem/#findComment-266069 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.