Page 1 of 1

Assigning data using PHP

Posted: Thu May 13, 2010 6:00 am
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.

Re: Assigning data using PHP

Posted: Thu May 13, 2010 7:36 am
by roders
What would be the purpose of doing such a thing?

Re: Assigning data using PHP

Posted: Thu May 13, 2010 7:49 am
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