renno Posted November 3, 2006 Share Posted November 3, 2006 Hey, I'm sorry if this is a novice question...How is the best way to transfer a variable to another page...For example getting a variable $ex1 on 'index.php' to $ex1 on 'form.html', with the files being located in the same directory folder... Maybe using headers?Cheers Link to comment https://forums.phpfreaks.com/topic/26057-transferring-variables-between-pages/ Share on other sites More sharing options...
jcbarr Posted November 3, 2006 Share Posted November 3, 2006 You can use sessions, post it to the next page, attach it to the URL and grab it with the $_GET command on the following page. All depends on what kind of variable it is. Link to comment https://forums.phpfreaks.com/topic/26057-transferring-variables-between-pages/#findComment-119131 Share on other sites More sharing options...
pink Posted November 3, 2006 Share Posted November 3, 2006 Use $_POST if you feel that you don't want your information to show up on your URL. Use $_GET if you want all the variables to show up on your URL. Think of it as do you want someone to book mark the page? So far, I haven't found solutions using PHP only to POST without input type submit, but you can always use javascript to submit without input type submit if it's a form. You can always create your own <a href="http://us3.php.net/manual/en/ref.session.php">SESSION</a> variables and store it in memory so no matter which page you go, there exist variables you want to use until session expires. This way, you don't have to show anything in URL and not rely on people to click submit button. Happy Friday ;) Link to comment https://forums.phpfreaks.com/topic/26057-transferring-variables-between-pages/#findComment-119138 Share on other sites More sharing options...
renno Posted November 3, 2006 Author Share Posted November 3, 2006 Many thanks... Link to comment https://forums.phpfreaks.com/topic/26057-transferring-variables-between-pages/#findComment-119149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.