zgkhoo Posted October 31, 2007 Share Posted October 31, 2007 <?php if(isset($_POST['LANG'])){ if($_POST['LANG']=='EN'){ echo "hello <form action='index.php' method='post'> <select name='LANG'> <option value='EN'>English</option> <option value='CH'>Chinese</option> </select> <input type=submit name=submit value=submit> </form> </br></br></br> <form action='index.php' method='post'> <h1>Welcome to ABC MLM<h1/><br/> <img src='logo.gif' width='200' height='200'></br> <h4> Username:<input type='text' name='username' /><br> Password: <input type='password' name='password' /><br> <input type='submit' name='Login' value='Log In'/> <!--<input type='submit' name='cDB' value='cDB'/>--> <!--<input type='submit' name='cPerson' value='cPerson'/>--> <input type='submit' name='cAdmin' value='cAdmin'/> </br> <a href='./menu/adminenter.php'>admin menu</a> <a href='./menu/userenter.php'>user menu</a> <a href='install_db.php'>install db</a> </h4> </form> </br> <h5> <a href=register.php>Sign Up</a> </h5> "; }//end if else{ echo "你好 <form action='index.php' method='post'> <select name='LANG'> <option value='EN'>English英文</option> <option value='CH'>Chinese中文</option> </select> <input type=submit name=submit value=应用> </form> </br></br></br> <form action='index.php' method='post'> <h1>欢迎来到ABC MLM<h1/><br/> <img src='logo.gif' width='200' height='200'></br> <h4> 帐号<input type='text' name='username' /><br> 密码<input type='password' name='password' /><br> <input type='submit' name='Login' value='登入'/> <!--<input type='submit' name='cDB' value='cDB'/>--> <!--<input type='submit' name='cPerson' value='cPerson'/>--> <input type='submit' name='cAdmin' value='cAdmin'/> </br> <a href='./menu/adminenter.php'>admin menu</a> <a href='./menu/userenter.php'>user menu</a> <a href='install_db.php'>install db</a> </h4> </form> </br> <h5> <a href=register.php>登记</a> </h5> "; }//end else }//end of isset ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> //to show live time and date // Current Server Time script (SSI or PHP)- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use. //Depending on whether your page supports SSI (.shtml) or PHP (.php), UNCOMMENT the line below your page supports and COMMENT the one it does not: //Default is that SSI method is uncommented, and PHP is commented: //var currenttime = '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' //SSI method of getting server date var currenttime = '<?php print date("F d, Y g:i:s", time())?>' //PHP method of getting server date ///////////Stop editting here///////////////////////////////// var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var serverdate=new Date(currenttime) function padlength(what){ var output=(what.toString().length==1)? "0"+what : what return output } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) //document.getElementById("servertime").innerHTML=datestring+" "+timestring document.getElementById("serverdate").innerHTML=datestring document.getElementById("servertime").innerHTML=timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script> </head> <body> <center> <form action=index.php method=post> <select name='LANG'> <option value='EN'>English</option> <option value='CH'>Chinese</option> </select> <input type=submit name=submit value=submit> </form> </br></br></br> <form action="index.php" method="post"> <h1>Welcome to ABC MLM<h1/><br/> <img src="logo.gif" width="200" height="200"></br> <h4> Username:<input type="text" name="username" /><br> Password: <input type="password" name="password" /><br> <input type="submit" name="Login" value="Log In"/> <!--<input type="submit" name="cDB" value="cDB"/>--> <!--<input type="submit" name="cPerson" value="cPerson"/>--> <input type="submit" name="cAdmin" value="cAdmin"/> </br> <a href="./menu/adminenter.php">admin menu</a> <a href="./menu/userenter.php">user menu</a> <a href="install_db.php">install db</a> </h4> </form> </br> <h5> <a href=register.php>Sign Up</a> </h5> </center> <span class="servertime" id="servertime"></span> </body> </html> after i change the language option(select box) neither to english or chinese, then it will appear another form/image/button out, the default one..wont disappear, how to solve it? Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/ Share on other sites More sharing options...
purefan Posted October 31, 2007 Share Posted October 31, 2007 not really sure if I understand the issue you're describing, but from the code you posted you are outputting the form before the rest of the html code, remember php is server side handled and anything outside the <?php ?> tags is not processed by the php engine, so you are actually outputting the form for choosing the language regardless of what the action on the page has been. Also, I would advise strongly against using such big if/else blocks for a simple echo command, an alternative is to load a template file and replace specific language tags with the appropriate language code, similar to what Smarty does but simpler for keeping it practical, just a thought though... Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381710 Share on other sites More sharing options...
Daniel0 Posted October 31, 2007 Share Posted October 31, 2007 Well, you have another form outside the PHP code... Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381717 Share on other sites More sharing options...
zgkhoo Posted October 31, 2007 Author Share Posted October 31, 2007 when user log in to my page , it is certainly i need display title of my site,username, password form for the user, i dun wan when user log in then in my page just appear a select box for user to choose English or chinese...after they select language only appear those title username,password etc form element. wat i wan is user log in then default will display all these element is english and if user choose change to chinese then the page become chinese...by display those element with chinese label get wat i meant? Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381722 Share on other sites More sharing options...
zgkhoo Posted October 31, 2007 Author Share Posted October 31, 2007 Well, you have another form outside the PHP code... the outside php code is for default display elements in english , if i without it, how can i display something to user when user browse this page? since my php code's display those element only after change language action(select box) taken.. thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381723 Share on other sites More sharing options...
zgkhoo Posted October 31, 2007 Author Share Posted October 31, 2007 not really sure if I understand the issue you're describing, but from the code you posted you are outputting the form before the rest of the html code, remember php is server side handled and anything outside the <?php ?> tags is not processed by the php engine, so you are actually outputting the form for choosing the language regardless of what the action on the page has been. Also, I would advise strongly against using such big if/else blocks for a simple echo command, an alternative is to load a template file and replace specific language tags with the appropriate language code, similar to what Smarty does but simpler for keeping it practical, just a thought though... then wat solution u recommend? Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381726 Share on other sites More sharing options...
zgkhoo Posted October 31, 2007 Author Share Posted October 31, 2007 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381790 Share on other sites More sharing options...
zgkhoo Posted October 31, 2007 Author Share Posted October 31, 2007 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/75450-solved-double-language-site-design-problem/#findComment-381843 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.