/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function redirect($src=null, $rtnString=false) { global $path; switch(true) { $host = $uri = ""; break; case ($src == null || $src[0] == "/") : $host = "http://".$_SERVER['HTTP_HOST']; break; default : $host = "http://".$_SERVER['HTTP_HOST']; break; } $src = generateGetValue($src); if($rtnString) { echo $host.$uri.$src; return; } } function getLink($value, $src=null, $att=null, $post=false, $stringReturn=null) { global $path; if($src == null) $src = "#"; if($att != null) $att = " ".$att; $src = generateGetValue($src); if($post) { $action = ($postAction[0] != null) ? $postAction[0] : $_SERVER["REQUEST_URI"] ; $return = "<form style=\"display:none;\" id=\"".$id."\" action=\"".$action."\" method=\"post\" enctype=\"application/x-www-form-urlencoded\">"; foreach($params as $key) { $return .= "<input type=\"hidden\" name=\"".$param[0]."\" value=\"".$param[1]."\" />"; } $return .= "</form>"; $return .= "<a href=\"javascript:void(0);\" onclick=\"getElementById('".$id."').submit();\"".$att.">".$value."</a>"; } else { $post = false; } } if(!$post) { $return = "<a href=\"".$src."\"".$att.">".$value."</a>"; } if($stringReturn) return $return; echo $return; } function generateGetValue($src=null, $byPassException=true) { } else { foreach($argv as $value) { if($pos === false) { $arg[$value] = ""; } else { } } foreach($arg as $key => $value) { $src .= $key; if($value != "") $src .= "=".$value; $src .= "&"; } } } return $src; }