| ruben |
|
|---|---|
|
i have a form (contactus plugin) where i want the url from the last visted page someone came from to be added in a hidden field $_SESSION['visited_pages'][] = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING']; and then get the last page with $prev_page = $_SESSION['visited_pages'][(count($_SESSION['visited_pages']-1)]; due to my lack of knowledge of php i dont know how to use it in the form.....
if($cfg['plugin']['contactus']['subjects'] != ''){
$cfgsubjects = explode(";", $cfg['plugin']['contactus']['subjects']);
if (count($cfgsubjects) > 1 && !empty($cfgsubjects[1])){
$cfgsubj = "<select name=\"subject\">\n";
$iii=0;
foreach($cfgsubjects as $x) {
if (!empty($x)) {
$subjects[$iii] = trim($x);
if ($iii==$subject || (empty($subject) && $iii==0)) {
$cfgsubj .= "<option value=\"".$iii."\" selected=\"selected\">".$subjects[$iii]."</option>\n";
} else {
$cfgsubj .= "<option value=\"".$iii."\">".$subjects[$iii]."</option>\n";
}
$iii++;
}
}
$cfgsubj .= "</select>\n";
}else{
$cfgsubj = '';
}
}else{
$cfgsubj = "<input type=\"hidden\" maxlength=\"100\" size=\"24\" value=\"URL HERE\" name=\"subject\" id=\"subject\" class=\"text\" />";
}
or if someone has a better solution to do this? |
| Trustmaster |
|
|---|---|
|
Should be as easy as this: $cfgsubj = "<input type=\"hidden\" maxlength=\"100\" size=\"24\" value=\"".$_SESSION['visited_pages'][count($_SESSION['visited_pages'])-1]."\" name=\"subject\" id=\"subject\" class=\"text\" />"; BTW, there's a bug with parenthesis in that $prev_page sequence, it should be $prev_page = $_SESSION['visited_pages'][count($_SESSION['visited_pages'])-1];
May the Source be with you!
|
| ruben |
|
|---|---|
|
works! thanks! |