Assigning data using PHP

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
gajubhai
Forum Newbie
Posts: 4
Joined: Fri Apr 11, 2008 3:57 am

Assigning data using PHP

Post by gajubhai »

Hi..
I am new to php. I want to try simple application. My form contains two empty text boxes and one button name copy. Can anybody tel me the php script for copying data from one textbox to other? Suppose I typed "Hello world!" in texbox1 and clicked copy button then textbox2 shoul also display "Hello world!"

Please help.
roders
Forum Commoner
Posts: 68
Joined: Tue Oct 20, 2009 9:29 am

Re: Assigning data using PHP

Post by roders »

What would be the purpose of doing such a thing?
thamizh
Forum Newbie
Posts: 18
Joined: Wed Apr 14, 2010 7:25 am

Re: Assigning data using PHP

Post by thamizh »

Code: Select all

<?php 
if(isset($_POST['submit']))
{
$txtvalue = $_POST['txt1'];
}
?>
<form method="post" action="copy.php">
<input type='text' name='txt1' value='<?php echo $txtvalue;?>'/>
<input type='text' name='txt2' value='<?php echo $txtvalue;?>'/>
<input type='submit' name='submit' value='copy'/>
</form>
save the file as copy.php it give the desired result as u want
hope it helps u
Post Reply