Jump to content

how to post the values from one page to otherpage using anchor tag in PHP?


krishna.p

Recommended Posts

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

 

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

@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:

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

 

 

 

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>

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.