Jenling Posted March 13, 2008 Share Posted March 13, 2008 Hello to all expert!I want to ask how to pass my variable to the next page by a link?How it works?Can someone help me? For example, I want to pass the value of id, day, month, year and start_time, end_time to another page, what can I do with this??? ??? Link to comment https://forums.phpfreaks.com/topic/95925-pass-variable-through-link/ Share on other sites More sharing options...
php_dave Posted March 13, 2008 Share Posted March 13, 2008 Hi, The easiest way as terms of execution is passing it directly in the url of the page you are calling for example www.yourdomain.com/mypage.php?id=1&day=01&month=02&year=08 In mypage.php you can access the vars using the $_GET superglobal for example: if (isset($_GET['id')) { $id = $_GET['id'] $date = $_GET['date'] //etc... } There is a security draw back in passing vars via the url but if you google $_GET and security there are some good tuts on how to sanitise your passed data! HTH Dave Link to comment https://forums.phpfreaks.com/topic/95925-pass-variable-through-link/#findComment-491100 Share on other sites More sharing options...
Jenling Posted March 13, 2008 Author Share Posted March 13, 2008 Hello, thanks for your reply. How if the id I want to pass is depend on the user key in?how can i pass the value then? ??? Link to comment https://forums.phpfreaks.com/topic/95925-pass-variable-through-link/#findComment-491205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.