php - Preventing adding link to another link -
hello i'm working php generate menu own build cms system.
i'm making dynamic link : $url = $_server['http_host'].$_server['request_uri']."/"; i'm adding . $row_menu['page_link'] database. @ first works perfect:
as illustration =
$row_menu['page_link'] = page2; $url . $row_menu['page_link']; it homecoming illustration : http://example.com/page2
but when click again, adds page2 1 time again : http://example.com/page2/page2
how prevent this?
thanks in advance!
because @ first time $_server['request_uri'] http://example.com when user click on link value of $_server['request_uri'] become http://example.com/page2.that's why appending 2 times.
instead can utilize http_referer like
$url = $_server['http_referer'].$row_menu['page_link']; considering $_server['http_referer'] results http://example.com.also can seek like
$protocol = 'http'; $url = $protocol .'//'. $_server['http_host'] .'/'. $row_menu['page_link']; php mysql url
No comments:
Post a Comment