How to pass value of one page's textbox to another page's te

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
premecorp
Forum Newbie
Posts: 15
Joined: Fri Nov 04, 2011 9:12 am

How to pass value of one page's textbox to another page's te

Post by premecorp »

Hi Friends,

I have one requirement where I have one textbox & submit button, when I click that button by filling value on that textbox I need it will redirect to different page & the value of that textbox automatically come into this page textbox. If any one have any idea kindly help me.


Regards,
Premashish
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: How to pass value of one page's textbox to another page'

Post by social_experiment »

Assuming your first text box is called 'textbox1' you can use the following code on the second page

Code: Select all

<input type="text" name="textbox2" value="<?php echo $_POST['textbox1']; ?>" />
This will give the textbox (no. 2 that is) the value of textbox 1 when submitted. You could also store the value from the first textbox in a session variable, depending on where the page is submitted. If you can supply more details about what you have in mind that would be helpful
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply