Computing.Net > Forums > Web Development > Php copy text from input to another

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Php copy text from input to another

Reply to Message Icon

Name: ian_ok
Date: March 5, 2005 at 07:20:32 Pacific
OS: win xp 98 & 2k
CPU/Ram: p3 512
Comment:

Is there any PHP code that will let a user click a button and it will copy the contents of a input field form to another input field?

Ian



Sponsored Link
Ads by Google

Response Number 1
Name: Khalid
Date: March 5, 2005 at 08:33:24 Pacific
Reply:

PHP is a serversided scripting language, so you'll need the form input to be send to the server to make a copy of the input.

More easily it can be done with javascript. I have included an example:

<script type="text/javascript">
function CopyInput(form)
{
form.copied.value = form.original.value;
}
</script>

<form action="blabla" method="post">
<input type="text" name="original" size="10">
<input type="text" name="copied" size="10">
<input type="button" name="copy" value="Copy fields" onClick="CopyInput(this.form)">
</form>


0

Response Number 2
Name: fambi
Date: March 6, 2005 at 08:52:38 Pacific
Reply:

Yep, it's very important to understand the difference between server-side and client-side scripting.

If you want things to happen on the web-browser (as described) as an immediate result of something else that has happened on the web-browser, you need client-side scripting (i.e. javascripts)

If you're interested in SMS, visit my wife's site .


0

Response Number 3
Name: ian_ok
Date: March 6, 2005 at 12:35:49 Pacific
Reply:

Thanks for that, I knew about java being able to do it, but the code given will help me lots.

Was more keen to stay away from java, but seeing that it is only a form for webmasters to add a link to my site, they will 90% have java enabled or at least know hot to enable it!

Thank once again.

Ian


0

Response Number 4
Name: Don Arnett
Date: March 6, 2005 at 16:36:16 Pacific
Reply:

small point:

java is not the same thing as javascript


two very different languages with different purposes


0

Response Number 5
Name: ian_ok
Date: March 24, 2005 at 07:05:37 Pacific
Reply:

Yes, cheers for that Don....

Now I think about it, you are spot on.....meant to say Javascript!

Ian


Sanlucar de Barrameda


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Php copy text from input to another

php copy from file script www.computing.net/answers/webdevel/php-copy-from-file-script/392.html

Text from txt into HTML www.computing.net/answers/webdevel/text-from-txt-into-html/1816.html

Help with a PHP copy scrip www.computing.net/answers/webdevel/help-with-a-php-copy-scrip/737.html