romio Posted March 10, 2006 Share Posted March 10, 2006 This is my menu.php(part of it) file, what am trying to do is to check what language would the user choose, [code] <form method='post' action='index.php'> <a class='menu' href='index.php?ID'> <input type='hidden' name='ID' id='ID_Eng' value='ID_Eng'><img src='content/images/en.gif' border=0 alt='English'></a> <a class='menu' href='index.php?ID'> <input type='hidden' name='ID' id='ID_Rus' value='ID_Rus'><img src='content/images/ru.gif' border=0 alt='Russian'></a> <a class='menu' href='index.php?ID'> <input type='hidden' name='ID' id='ID_Ger' value='ID_Ger'><img src='content/images/ge.gif' border=0 alt='German'></a> <input type='hidden' name='Check_ID' value='Check'> </form>[/code]and this is my index.php(part of it)[code]<?phpif (!@$page) $page = "home.htm";if ($_POST['Check_ID']) { $id=$_GET['ID']; if ($id = 'ID_Eng') { $directory = "content/en/"; } else if ($id = 'ID_Rus') { $directory = "content/ru/"; } else if ($id = 'ID_Ger') { $directory = "content/ge/"; }}[/code]and for the rest of the menu thats what i got:[code] <tr><td class='menuDivLine'></td></tr>"; if ($page=="home"){echo"<tr bgcolor='#C5B881'>";} else{echo"<tr onMouseover=this.bgColor='#C5B881'; onMouseout=this.bgColor='#ACE6FD'; bgcolor='#ACE6FD'>";}echo" <td><a class='menu' href='?page=home.htm'>Home</a></td> </tr> <tr><td class='menuDivLine'></td></tr>"; if ($page=="fact_sheet"){echo"<tr bgcolor='#C5B881'>";} else{echo"<tr onMouseover=this.bgColor='#C5B881'; onMouseout=this.bgColor='#9CDAF3'; bgcolor='#9CDAF3'>";}echo" <td><a class='menu' href='?page=fact_sheet.htm'>FACT SHEET</a></td> </tr>[/code]What am I doing wrong, Thanks Quote Link to comment Share on other sites More sharing options...
lessthanthree Posted March 10, 2006 Share Posted March 10, 2006 I think you've got a bit confused as to whether to use GET or POST to determine this. You won't have posted anything because despite your form having a method of post, there is no submit form button. Consequently nothing will get posted.If you want to use GET with <a> tags and hyperlinks, you don't need to use the form at all.I think you sould decide which method you would rather use, we can then go from there. Quote Link to comment Share on other sites More sharing options...
romio Posted March 10, 2006 Author Share Posted March 10, 2006 [!--quoteo(post=353557:date=Mar 10 2006, 04:36 AM:name=lessthanthree)--][div class=\'quotetop\']QUOTE(lessthanthree @ Mar 10 2006, 04:36 AM) [snapback]353557[/snapback][/div][div class=\'quotemain\'][!--quotec--]I think you've got a bit confused as to whether to use GET or POST to determine this. You won't have posted anything because despite your form having a method of post, there is no submit form button. Consequently nothing will get posted.If you want to use GET with <a> tags and hyperlinks, you don't need to use the form at all.I think you sould decide which method you would rather use, we can then go from there.[/quote]I think using the <a> tags would be much better, I don’t think the form is needed, but am not sure how to implement it.Thanks Quote Link to comment Share on other sites More sharing options...
lessthanthree Posted March 10, 2006 Share Posted March 10, 2006 In that case..do your href's something like the following and lose the form.[code]<a href='index.php?language=eng'>English</a><a href='index.php?language=ru'>Russian</a>//etc[/code]then on your index.php page[code]switch($_GET["language"]){ case("eng"): $directory = 'content/en'; break; case("ru"): $directory = 'content/ru'; break; //etc default: print "An Invalid or No language was specified";}[/code] Quote Link to comment Share on other sites More sharing options...
romio Posted March 10, 2006 Author Share Posted March 10, 2006 thats what i have for the moment but its aint working yet:menu.php[code]echo" <!-- menu start --><table border='0' cellpadding='0' cellspacing='0' valign='top'> <tr> <td><img src='template/images/left_img.jpg'></td> </tr> <tr> <td align='center' valign='middle' bgcolor='#B5E3F5'> <a class='menu' href='index.php?language=en'><img src='content/images/en.gif' border=0 alt='English'></a> <a class='menu' href='index.php?language=ru'><img src='content/images/ru.gif' border=0 alt='Russian'></a> <a class='menu' href='index.php?language=ge'><img src='content/images/ge.gif' border=0 alt='German'></a> </td> </tr> <tr><td class='menuDivLine'></td></tr>"; if ($page=="home"){echo"<tr bgcolor='#C5B881'>";} else{echo"<tr onMouseover=this.bgColor='#C5B881'; onMouseout=this.bgColor='#ACE6FD'; bgcolor='#ACE6FD'>";}echo" <td><a class='menu' href='?page=home.htm'>Home</a></td> </tr> <tr><td class='menuDivLine'></td></tr>"; if ($page=="fact_sheet"){echo"<tr bgcolor='#C5B881'>";} else{echo"<tr onMouseover=this.bgColor='#C5B881'; onMouseout=this.bgColor='#9CDAF3'; bgcolor='#9CDAF3'>";}echo" <td><a class='menu' href='?page=fact_sheet.htm'>FACT SHEET</a></td> </tr>...etc[/code]index.php[code]<?phpif (!@$page) $page = 'home.htm';switch($_GET['language']){ case('en'): $directory = 'content/en'; break; case('ru'): $directory = 'content/ru'; break; case('ge'): $directory = 'content/ge'; break; default: $directory = 'content/ge';}$PATH = $directory.$page;include("template/head.php");[/code] Quote Link to comment Share on other sites More sharing options...
lessthanthree Posted March 10, 2006 Share Posted March 10, 2006 in what sense is it not working?do you get any errors? does $_GET hold any values on index.php? is $directory empty? Quote Link to comment Share on other sites More sharing options...
romio Posted March 10, 2006 Author Share Posted March 10, 2006 I found the mistake.... I had it this way:[code]$directory = 'content/en';[/code]which it should have been this way[code]$directory = 'content/en/';[/code]Thanks alot for your help Quote Link to comment 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.