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 Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/ 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? Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602737 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 Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602750 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 ; ?> Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602753 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: Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602754 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 Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602762 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> Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602765 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> Link to comment https://forums.phpfreaks.com/topic/117181-how-to-post-the-values-from-one-page-to-otherpage-using-anchor-tag-in-php/#findComment-602784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.