bonty89 Posted February 28, 2010 Share Posted February 28, 2010 Guyz I wanna know how to add like this on inside web links (php) eg: http://www.websitename.net/index.php?mode=register http://www.websitename.net/index.php?mode=login can any1 help pls ... thanks Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/ Share on other sites More sharing options...
akshay Posted February 28, 2010 Share Posted February 28, 2010 Oh. I used to wonder a lot about such links too! It's nothing but data posted using GET method. It can be retrived using $_GET[variable] Example: If in a form: <form method="GET" action="url.php"> ... ... <input type="text" name="email"> ...</form> would submit /[email protected] on URL.php, we'd then be able to use this email, like print $_GET; For any help you may msg. me. Hope it helps Akshay Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1019395 Share on other sites More sharing options...
Catfish Posted February 28, 2010 Share Posted February 28, 2010 if you want more than one variable on the end of the url do this: http://www.blah.com/script.php?one=two&two=three&three=four etc. Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1019514 Share on other sites More sharing options...
dezkit Posted February 28, 2010 Share Posted February 28, 2010 <?php $mode = $_GET["mode"]; if($mode == "register"){ echo "Registered!"; } else { ?> <a href="/index.php?mode=register">Register</a> Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1019555 Share on other sites More sharing options...
Dennis1986 Posted February 28, 2010 Share Posted February 28, 2010 Read more about it here: http://www.w3schools.com/PHP/php_get.asp Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1019562 Share on other sites More sharing options...
bonty89 Posted March 1, 2010 Author Share Posted March 1, 2010 guyz I wanna know how set variable on the Index.php file eg: when user click to login it should display like this http://www.anywebsite.org/index.php?action=login similar to this forum profile link http://www.phpfreaks.com/forums/index.php?action=profile search http://www.phpfreaks.com/forums/index.php?action=search how to write like that Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1019814 Share on other sites More sharing options...
Catfish Posted March 2, 2010 Share Posted March 2, 2010 this URL: http://www.anywebsite.org/index.php?action=login is just using the GET method to pass the values to index.php if you have a HTML file like: <html><head><title>test</title></head><body> <form method="GET" action="index.php"> <input type="hidden" name="action" value="login"/> <input type="submit" value="Login"/> </form> </body></html> Then when you press "Login" button, you will be directly to index.php with variable 'action' passed using method 'GET' and value of 'action' will be a string: 'login'. Link to comment https://forums.phpfreaks.com/topic/193665-guyz-i-wanna-know-how-to-add-like-this-on-link/#findComment-1020180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.