I have successfull created versions of the ListDocs snippets that filter in only documents starting with EN_ or PL_ or IT_ etc. based on $_SESSION["Lingo"] set manually.
What I thought would be a simple PHP snippet to set $_SESSION["Lingo"] just isn't working! For me, it correctly shows the form , then when I press Submit, Etomite displays my home page, and the variable is not set.
I know that I can set $_SESSION["Lingo"] from within a snippet, but my code never takes me there. Please tell me what I am doing wrong, before my head explodes!
Snippet "Lingo"
//tried several different Ifs
//if(!isset($_POST["LingoSelect_submit"]))
if(!isset($_POST["Lingo"]))
{
$output ="";
$output .="Language is currently set to ".$_SESSION["Lingo"]."
";
$output .="Please choose a new language
";
$output .="<form id=\"LingoSelect\" action=\"\" method=\"post\" >";
$output .="<div><table>";
$output .="<input type=\"hidden\" name=\"id\" value=\"\" />";
$output .="<tr><td><input type=\"radio\" name=\"Lingo\" value=\"en\" /></td><td>English</td></tr>";
$output .="<tr><td><input type=\"radio\" name=\"Lingo\" value=\"it\" /></td><td>Italian</td></tr>";
$output .="<tr><td><input type=\"radio\" name=\"Lingo\" value=\"pl\" /></td><td>Polish</td></tr>";
$output .="<tr><td><input type=\"radio\" name=\"Lingo\" value=\"fr\" /></td><td>French</td></tr>";
$output .="<tr><td style=\"text-align:center;\">";
$output .="<input type=\"submit\" id=\"LingoSelect_submit\" name=\"LingoSelect_submit\" value=\"Submit\" class=\"button\" /></td><td></td>";
$output .="</tr></table></div></form>";
return stripslashes($output);
}
else
{
$output ="";
$_SESSION["Lingo"]=$_POST["Lingo"];
$output .="Your language is now " .$_SESSION["Lingo"];
return $output;
}
Lots of room for improvement...
Edited by Ralph, 25 November 2009 - 04:29 PM.
Enclosed snippet code within code tags...












