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 Quote Link to comment 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. Quote Link to comment 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 ;) Quote Link to comment Share on other sites More sharing options...
renno Posted November 3, 2006 Author Share Posted November 3, 2006 Many thanks... Quote Link to comment 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.