php - why page redirect to home page when try to change language? -
First of all, my problem occurs when I try to change a language in the website, the language changes, but Then it redirects to the home page, not the current page, though the change in language is a success but how can I change it on the current page?
This code is from the inc.language.php file
The code is such.
After connecting to db
if ($ numrows_langs> 1) {$ languagelist = "& lt; form action = \" \ "method = \ "Post \" name = \ "language_form \" & gt; & lt; table cellpadding = 0 cells = 0 style = \ "padding: 5px 0px \" & gt; & lt; tr & gt; & lt; td Style = \ "padding-right: 5px \" & gt; $ LANGUAGE & lt; / td> & lt; td & gt; & lt; choose name = \ "lang \" onchange = \ "document.language_form Submit (); \ "Style = \" width: 110px \ "& gt;"; While ($ r_langs = mysql_fetch_array ($ sql_langs)) {$ LangID_langs = $ r_langs ["langaid"]; $ StrName_langs = $ r_langs ["strName"]; $ IsDefault_langs = $ r_langs ["isDefault"]; If ($ _ session ['langid'] == $ LangIID_lings) {$ selected selection = "selected = \" selected \ ""; } And {$ showselected = "$ LangID_langs"; } $ Languagelist = "& Lt; option value = \" $ LangID_langs \ "$ selected & gt; $ strName_langs & lt; / option & gt;"; } $ Languagelist = "& Lt; / select> gt; & lt; / td> & lt; / tr & gt; & lt; / table & gt; & lt; / form & gt;";
}
Hope someone can recommend me a way to solve this.
Your form's verb {/ code> element is an empty string, which is a file name Is interpreted as a relative path, so it refers to the directory that contains the current page. In other words, if the page is in
foo / bar.php
a and
You need to enter the correct URL in your form's action attribute.
Comments
Post a Comment