liamloveslearning Posted January 26, 2010 Share Posted January 26, 2010 Hi all, Bit of an amateur question but, I have a button on my page that when clicked I want it to takr the user to a page and auto fill the field values depending on what the page was, anybody know of any tutorials or what this method is called? Would i give the button an ID and retrieve the data via a GET function? Quote Link to comment Share on other sites More sharing options...
manwhoeatsrats Posted January 26, 2010 Share Posted January 26, 2010 I have always used php on the next page to populate fields from a previous form. here is an example. first a simple form <form name="form1" action="foo.php" method="POST"> <input type="text" name="value1" value="this is a test" /> <input type="submit" value="submit" /> </form> then the script which is called by the form action. <form name="whatever" action="" method="POST"> Input type="text" name="whatever" value = "<?php echo $_POST[value1]; ?>" /> </form> Notice in the form the beginning and end of PHP. This is how you pull the post value into the field on the next page. keep in mind you can also put hidden fields on the form of the first page. hope this helps Quote Link to comment Share on other sites More sharing options...
liamloveslearning Posted January 26, 2010 Author Share Posted January 26, 2010 thanks manwhoeatsrats Thats brilliant, Im limited tho strict html, is it possible to create the same effect without php? Quote Link to comment Share on other sites More sharing options...
manwhoeatsrats Posted January 26, 2010 Share Posted January 26, 2010 you would likely be able to do it with javaScript. unforunetly, javascript is one of my weak points. If you have control of the server however, you can easily install apache, mysql and PHP. in fact you can have it up and running in under 20 minutes. I recommend Xampp it is available for windows with a self installer, and is available for linux and even macs. http://www.apachefriends.org/en/xampp.html I wish I could be of more help, but once again I am not good with javascript. cheers 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.