LemonInflux Posted October 26, 2007 Share Posted October 26, 2007 First: How do I add a hyperlink to add another variable onto the URL? Say my page is this: localhost/test_site/index.php?id=1 And I have a link on that page that goes to localhost/test_site/index.php?id1&act=0 I would just link like that, but it's in a header file included on every page. The second: Why isn't this function working? <?php function logOut(){ $_user = ""; $f_pass = ""; session_unset(); session_destroy(); header("Location: ?"); } ?> Basically, when the function is activated, it should destroy the session, so the user logs out. Quote Link to comment https://forums.phpfreaks.com/topic/74919-2-questions/ Share on other sites More sharing options...
premiso Posted October 26, 2007 Share Posted October 26, 2007 To completely kill a session you have to unset the session cookie. www.php.net/session localhost/test_site/index.php?id1=value&act=title&bob=two&three=four Quote Link to comment https://forums.phpfreaks.com/topic/74919-2-questions/#findComment-378811 Share on other sites More sharing options...
LemonInflux Posted October 26, 2007 Author Share Posted October 26, 2007 I know how to structure a URL, I was asking how I could add things to it like <a href="?var=1"> but if my URL was already index.php?id=1, having a link to ?var=1 wouldn't make id=1&var=1, it makes ?var=1 Quote Link to comment https://forums.phpfreaks.com/topic/74919-2-questions/#findComment-378816 Share on other sites More sharing options...
premiso Posted October 26, 2007 Share Posted October 26, 2007 <?php $get_data = ""; foreach ($_GET as $key => $val) { $get_data .= "&" . $key . "=" . $val; } echo '<a href="index.php?var=1' . $get_data . '">Link Here</a>'; ?> Like that? Quote Link to comment https://forums.phpfreaks.com/topic/74919-2-questions/#findComment-378819 Share on other sites More sharing options...
LemonInflux Posted October 26, 2007 Author Share Posted October 26, 2007 First: How do I add a hyperlink to add another variable onto the URL? Say my page is this: localhost/test_site/index.php?id=1 And I have a link on that page that goes to localhost/test_site/index.php?id1&act=0 I would just link like that, but it's in a header file included on every page. Also, fixed the second problem myself. Quote Link to comment https://forums.phpfreaks.com/topic/74919-2-questions/#findComment-378830 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.