krishna.p Posted July 29, 2008 Share Posted July 29, 2008 Hi experts, Im new to php. i want to pass the posted values of the current page to destination page using anchor tag. let me explain you breifly.. my current page is first.php which contains a total of 24 controls in it. it contains buttons named UPDATE,SUBMIT and links such as DETAILS. DETAILS link is written as follows. <a href="details.php">DETAILS</a> Now my requirement is, if i click on DETAILS link all the 24 posted values should get posted to details.php. would appreciate if you could please help me out..thanks in advance. Thanks, krishna.p Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 29, 2008 Share Posted July 29, 2008 Not quite sure I understand. You can't send POST data through a link without a little bit of Javascript and form tags. Can you show an example of what you want to accomplish? Quote Link to comment Share on other sites More sharing options...
krishna.p Posted July 29, 2008 Author Share Posted July 29, 2008 sure..let me explain you the simple example... current page i have controls like country,state and city drop downs and buttons like UPDATE,SUBMIT and links like DETAILS etc.. now if i click on DETAILS link, details.php should get opened and there i will use posted values from previous page like country,state and city and those 3 values are displayed in details.php. i dont mind using javascript,form tags in my code if im going to accomplish my target..would appreciate if you could please tell me how can i post values from the current page to destination page using this DETAILS link.. Thanks, krishna.p Quote Link to comment Share on other sites More sharing options...
d.shankar Posted July 29, 2008 Share Posted July 29, 2008 page1.php <?php echo "<a href='page2.php?value=12345'>Click Here to send the value to the next page</a>"; ?> page2.php <?php $var=$_GET['value']; echo "The value from page1.php is".$var ; ?> Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 29, 2008 Share Posted July 29, 2008 @d.shanker: He wants to use POST, not GET. =/ And why do you keep talking in quote boxes? Attention seeker much? @thread starter: I'm going to go eat then I'll post back with some code. Sorry. D: Quote Link to comment Share on other sites More sharing options...
krishna.p Posted July 29, 2008 Author Share Posted July 29, 2008 No problem... will be waiting for your reply... you are correct.. i want to post the data which may contain around 30 plus values... i think here first thing i need to do is to submit the page and and put those posted values into a session and pass that session values to the destination page... thanks, krishna.p Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 29, 2008 Share Posted July 29, 2008 Okay. I presume that you have form tags around these dropdowns, correct? Add a name attribute to the form: <form name="destination" action="details.php" method="post"> Something: <input type="text" /><br /> <a href="javascript:submitForm()">Details</a> </form> Then the Javascript: <script type="text/javascript"> function submitForm() { document.destination.submit(); } </script> Quote Link to comment Share on other sites More sharing options...
binujayaraj Posted July 29, 2008 Share Posted July 29, 2008 Check this out... <script language="Javascript"> function submitForm() { document.FORMNAME.action = 'details.php'; document.FORMNAME.method = 'post'; document.FORMNAME.submit(); } </script> on the HTML body <a href="Javascript: submitForm()">Details</a> 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.