anatak Posted October 14, 2006 Share Posted October 14, 2006 Hello,I am trying to make a form where the button will display the action (submit, clear, send, send password) in the language the user selects.I am trying to get this to work with english and japanese to start.the english version works but the japanese notDoes anybody know what exactly happens when a string is submitted with a <form method="POST">the first function is to determine if a user has set a language or has submitted a change for the language.the second funtion is to display the dropdown menu.the funtcion $case=button_caption(3); gets the caption out of a mysql database and is the caption displayed on the button.I am getting desperate and thinking about giving up on multilanguage forms. (IF ONLY IE supported buttons decently)I would be very thankfull if anyone can show me a way (any way) how to make a button with different language captions.Maybe it can be done using images with the caption ?Thank you for lookinganatak[code]<?php//- language_set() //set the language session var if not defined or changes the session var//- language_dropdown() //displays the dropdown menu for the languagesfunction language_set(){ if(!isset($_REQUEST['submit'])){ echo "geen request submit<br />"; if(!isset($_SESSION['userlanguage'])){ $_SESSION['userlanguage']='001'; //default English } }else{ $submit=$_REQUEST['submit']; echo "submit: " . $submit."<br />"; $case=button_caption(3);// $case="'".$case."'"; echo "case: ".$case."<br />"; if ($submit==$case){echo "submit == case<br />";} if($_REQUEST['submit']==$case){ echo "submit in case= ".$_REQUEST['submit']."<br />"; $_SESSION['userlanguage']=$_POST['Language']; echo "language= " . $_SESSION['userlanguage']."<br />"; } }}function language_dropdown(){//select all the available languages $Table01 = "language"; $Query01 = "SELECT * FROM $Table01 WHERE LanguageHide = 1 ORDER BY LanguageLan_Language;"; $Table02 = "language_button"; $language = "Lan_ButLan".$_SESSION['userlanguage']; $Query02 = "SELECT Lan_ButValue, $language FROM $Table02 WHERE Lan_ButId=3";// echo $Query02;//open read connection read_connection();//execute query $Result01 = mysql_query($Query01) or die(mysql_error()); $Result02 = select_1_row_check($Query02);//close read connection read_close(); if (gettype($Result02)== 'string'){ echo 'there was a problem please contact the administrator with the following message: '; echo $Result02; }else{ $Row02 = mysql_fetch_array($Result02); }?><form method="POST" action="<?php echo $_SERVER['PHP_SELF']."?page=index"; ?>" ><table><tr><td>Select your language</td></tr><tr><td><select name="Language"><?php//get results in row and display row while($Row01 = mysql_fetch_array($Result01)){ ?> <option value="<?php echo $Row01['LanguageLan_Nr']; ?>"><?php echo $Row01['LanguageLan_Language']; ?></option><?php }?></select></td></tr><tr><td><?php $button=button_caption(3); ?><input type="submit" name="submit" value="<?php echo $button; ?>"><br /><a href="<?php echo $button; ?>"><?php echo $button; ?></a><?php echo "<br />test".$button=button_caption(3); ?></td></tr> </table> </form><?php}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23939-submitting-japanese-text-how-to-do-it/ Share on other sites More sharing options...
Daniel0 Posted October 14, 2006 Share Posted October 14, 2006 Try to change the encoding to utf-8:[code]header("Content-type: text/html; charset=utf-8");[/code]Note: Put this BEFORE anything is output. Quote Link to comment https://forums.phpfreaks.com/topic/23939-submitting-japanese-text-how-to-do-it/#findComment-108815 Share on other sites More sharing options...
anatak Posted October 14, 2006 Author Share Posted October 14, 2006 I have this as header[code]<?phpsession_start();//IE6 session fixheader("Content-type: text/html; charset=utf-8; Cache-control: private");[/code]but it does not make any differencebefor I had this in my HTML[code]<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23939-submitting-japanese-text-how-to-do-it/#findComment-108908 Share on other sites More sharing options...
extrovertive Posted October 14, 2006 Share Posted October 14, 2006 Try EUC-JPas the character set.You may look into the"mb_convert_encoding" function Quote Link to comment https://forums.phpfreaks.com/topic/23939-submitting-japanese-text-how-to-do-it/#findComment-108911 Share on other sites More sharing options...
anatak Posted October 15, 2006 Author Share Posted October 15, 2006 Thank you for the suggesting but I have to keep everything in UTF-8 as the website has to be able to switch between languages.changing the character set to EUC-JP is really not a good thing to do I think.I guess there is not a real way around my problem. Quote Link to comment https://forums.phpfreaks.com/topic/23939-submitting-japanese-text-how-to-do-it/#findComment-108929 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.