Jump to content

JP128

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by JP128

  1. I am not asking for it to be written, i was just saying that it didn't work. I just needed some ideas because I didn't know 'what' to do... I knew what had to be done, but not how to do it. I think tho, with this, I can try to create on like this.
  2. The translator to encode does... but to decode it doesn't always work. Encoding: Christmas => mirishikiarichirinkaari //Works! Decoding: mirishikiarichirinkaari => chrith //Not so well =D
  3. Thanks a lot, I got the translator to work going to... Now, I just need to think of how to do it going back.
  4. is there a more efficient way to store the values for the letters?
  5. Ok, lets say that I wanted to build a letter translator. I would need something that would take, lets say for 'a' and to make it 'ka', and for 'b' to make it 'tu'. I have a whole list that my little sister uses to do it, and I wanted to see if I could create a translator in PHP. I was thinking of using eregi_replace(), but I ran into a problem. If it finds the letter again that it translated it from, it would re-translate. For example, Johnny would be 'Zumoritotofu'. With my translator it comes out to be 'Zidomoarihiarihiichimoeichimochimofu.' I know why it does it, I just don't know syntactically what to use to do it properly. here is the key: A - ka B - tu C - mi D - te E - ku F - lu G - ji H - ri I - ki J - zu K - me L - ta M - rin N - to O - mo P - no Q - ke R- shi S - ari T -chi U - do V - ru W - mei X - na Y - fu Z - zi and here is my code to do it. <?php if(isset($_POST['message']) && $_POST['toFrom'] == "to"){ echo translate_into($_POST['message']); } else if(isset($_POST['message']) && $_POST['toFrom'] == "from"){ echo translate_from($_POST['message']); } //Prints a message box. echo "<br><br> <form method='POST' name='translator'> <textarea rows=5 cols=25 name='message'></textarea><br> Translate to:<input type='radio' value='to' name='toFrom'><br> Translate from:<input type='radio' value='from' name='toFrom'><br> <input type='submit' value='Translate!' name='translate'><br> </form> "; function translate_into($string){ $newString = $string; $newString = eregi_replace('a','ka',$newString); $newString = eregi_replace('b','tu',$newString); $newString = eregi_replace('c','mi',$newString); $newString = eregi_replace('d','te',$newString); $newString = eregi_replace('e','ku',$newString); $newString = eregi_replace('f','lu',$newString); $newString = eregi_replace('g','ji',$newString); $newString = eregi_replace('h','ri',$newString); $newString = eregi_replace('i','ki',$newString); $newString = eregi_replace('j','zu',$newString); $newString = eregi_replace('k','me',$newString); $newString = eregi_replace('l','ta',$newString); $newString = eregi_replace('m','rin',$newString); $newString = eregi_replace('n','to',$newString); $newString = eregi_replace('o','mo',$newString); $newString = eregi_replace('p','no',$newString); $newString = eregi_replace('q','ke',$newString); $newString = eregi_replace('r','shi',$newString); $newString = eregi_replace('s','ari',$newString); $newString = eregi_replace('t','chi',$newString); $newString = eregi_replace('u','do',$newString); $newString = eregi_replace('v','ru',$newString); $newString = eregi_replace('w','mei',$newString); $newString = eregi_replace('x','na',$newString); $newString = eregi_replace('y','fu',$newString); $newString = eregi_replace('z','zi',$newString); return $newString; } function translate_from($string){ $newString = $string; $newString = eregi_replace('ka','a',$newString); $newString = eregi_replace('tu','b',$newString); $newString = eregi_replace('mi','c',$newString); $newString = eregi_replace('te','d',$newString); $newString = eregi_replace('ku','e',$newString); $newString = eregi_replace('lu','f',$newString); $newString = eregi_replace('ji','g',$newString); $newString = eregi_replace('ri','h',$newString); $newString = eregi_replace('ki','i',$newString); $newString = eregi_replace('zu','j',$newString); $newString = eregi_replace('me','k',$newString); $newString = eregi_replace('ta','l',$newString); $newString = eregi_replace('rin','m',$newString); $newString = eregi_replace('to','n',$newString); $newString = eregi_replace('mo','o',$newString); $newString = eregi_replace('no','p',$newString); $newString = eregi_replace('ke','q',$newString); $newString = eregi_replace('shi','r',$newString); $newString = eregi_replace('ari','s',$newString); $newString = eregi_replace('chi','t',$newString); $newString = eregi_replace('do','u',$newString); $newString = eregi_replace('ru','v',$newString); $newString = eregi_replace('mei','w',$newString); $newString = eregi_replace('na','x',$newString); $newString = eregi_replace('fu','y',$newString); $newString = eregi_replace('zi','z',$newString); return $newString; } ?>
  6. ok... lets just say there is a page with the word "true" or the word "false". How would I get that information from that page? Just to see what word exists
  7. ok, example. by clicking a button that submits a query to a page on my site, and I want to get a true or false value(if the word is on the page), and then show the answer... hmmm its hard to explain lol
  8. Yea, but how would I get it to see if it existed on a different page, without going to it?
  9. Ok, if I have a form that submits, how would I see if a word exists? Hmm, I am not sure how to explain this fully.
  10. JP128

    split

    Yea, well, I was trying to think of an easier method... I hate writing things that I might not need to.
  11. JP128

    PHP CURL

    if the https is the problem, try taking off the s.... https://www.verisign.com shows the same info as: http://www.verisign.com I checked
  12. JP128

    split

    Well, why not just have: <input type='text' name='first'><br> <input type='text' name='middle'><br> <input type='text' name='last'><br>
  13. What do you think that the hardest part about making a multi-d array?
  14. Yes, I know that it sorts them how they were stored... but if he got them that way in the first place, and then wanted those to be reversed, it would work his way. I read your sig... and saw Expert in mutli-d array analysis and mathematical modeling of real world applications using partial differential equations and integral calculus. lol, I am still a noob with arrays, and learning alot.. I know some stuff about multi D arrays, but thats with Java... but kinda the same thing
  15. <?php if ($handle = opendir('/some_dir/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $file1[] = $file; } } closedir($handle); } foreach(array_reverse($file1) as $file){ echo $file."<br>"; } ?>
  16. no problem... it took awhile to see.. when you make queries... you should format them like this... $sql = ("INSERT INTO table_name VALUES ( '$variable1', '$variable2', '$variable3', '$variable4', '$variable5', '$variable6', '$variable7', '$variable8', )"); When you format it like that, you can see the commas, and notice when they are missing. And, when you have "or die(mysql_error()); it will say something like: error at '' on line 3 so you can find it quicker.. Also when you have INSERT INTO table_name VALUES (field1,field2) ('Field1info','Field2info'); it is the same as: INSERT INTO table_name VALUES ('Field1info','Field2info');
  17. $Insert1= "INSERT INTO $Table_One (PD_Name, PD_Num, PD_Sprite, PD_HP, PD_ATK, PD_DEF, PD_SPLATK, PD_SPLDEF, PD_SPD, PD_EXP, PD_Type1, PD_Type2, PD_Gender, PD_Item, PD_ContestEXP, PD_Sprite1, PD_Sprite2, PD_Sprite3) VALUES ('$PD_Name', '$PD_Num', '$PD_Sprite', '$PD_HP', '$PD_ATK', '$PD_DEF', '$PD_SPLATK', '$PD_SPLDEF', '$PD_SPD','$PD_EXP', '$PD_Type1' , '$PD_Type2', '$PD_Gender', '$PD_Item', '$PD_ContestEXP', '$PD_Sprite1', '$PD_Sprite2', '$PD_Sprite3')"; //Insert Data if (mysql_query($Insert1,$connect)) {
  18. Found it.... change $Insert2 to: (PD_SPD, PD_EXP, PD_Type1, PD_Type2, PD_Gender, PD_Item, PD_ContestEXP, PD_Sprite1, PD_Sprite2, PD_Sprite3) VALUES ('$PD_SPD','$PD_EXP', '$PD_Type1', '$PD_Type2', '$PD_Gender', '$PD_Item', '$PD_ContestEXP', '$PD_Sprite1', '$PD_Sprite2', '$PD_Sprite3')";
  19. kk... in the mysql... type show create table Pokémon_Data; post what that says.
  20. That right there says that your $Insert1 has too many things to insert...
  21. Forms without an action='' automatically get/post back to themselves.
  22. Change: //Insert Data if (mysql_query($Insert1,$connect)) { to //Insert Data if (mysql_query($Insert1,$connect) or die(mysql_error()) {
×
×
  • 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.