PHP Code that Copies text

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
wee493
Forum Newbie
Posts: 22
Joined: Sat Sep 06, 2008 3:05 pm

PHP Code that Copies text

Post by wee493 »

I have been looking/trying to create a PHP script that copies text upon entering it. like the way that Tinyurl copies the text onto the clipboard automatically when u create a new url.

So when a user clicks submit it will copy specific text onto the clipboard.

Thanks
User avatar
8ennett
Forum Commoner
Posts: 63
Joined: Sat Sep 06, 2008 7:05 am

Re: PHP Code that Copies text

Post by 8ennett »

Not entirely sure what you mean, but I'm guessing you want to transfer variable data from one page to the next. I suggesr either cookies (for VERY short term storage), seesions (ok, need to explain this more in-depth) to database entries (for long term to indefinite storage!), or you can use the $_POST/$_GET post data!

If you need more info on either of these I would be more than happy to explain, just PM me!
wee493
Forum Newbie
Posts: 22
Joined: Sat Sep 06, 2008 3:05 pm

Re: PHP Code that Copies text

Post by wee493 »

Basicly what is want is a script that automatically copies text onto the clipboard
User avatar
8ennett
Forum Commoner
Posts: 63
Joined: Sat Sep 06, 2008 7:05 am

Re: PHP Code that Copies text

Post by 8ennett »

I see, but I fail to see what possible implications that can have on a php script really, sounds more like a javascript function to me!
User avatar
8ennett
Forum Commoner
Posts: 63
Joined: Sat Sep 06, 2008 7:05 am

Re: PHP Code that Copies text

Post by 8ennett »

If you want a piece of text copied to the clipboard I suggest you use this piece of code,
and just replace the variable <?php echo $variable.'you wish to use'; ?> to what ever you want the variable to become and copy to the clipboard!

Code: Select all

<SPAN ID="copytext" STYLE="height:whatever;width:whatever;background-color:grey">
<?php echo $variable.'you wish to use'; ?>
</SPAN>
 
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
wee493
Forum Newbie
Posts: 22
Joined: Sat Sep 06, 2008 3:05 pm

Re: PHP Code that Copies text

Post by wee493 »

8ennett wrote:I see, but I fail to see what possible implications that can have on a php script really, sounds more like a javascript function to me!
I think I found a solution but I dont know how to properly embed it. Any suggestions?

http://www.jeffothy.com/weblog/clipboard-copy/
User avatar
8ennett
Forum Commoner
Posts: 63
Joined: Sat Sep 06, 2008 7:05 am

Re: PHP Code that Copies text

Post by 8ennett »

Yes, my suggestion would be do NOT use the code you have recently discovered. If you do not understand my code (which does NOT even use javascript) then you should try to learn html before taking on the big boys, unless you know how to use the onclick function obviously?

If you haven't a clue what I'm sayin at all then go to google, look up 'PHP 101', and then learn something, next, go to a site that teaches you other languages besides PHP. If you know PHP/Javascript then you'll know what to do! If you know javascript then you don't need my help. If you don't know what either of these para's mean then learn how to program before learning a programming language!
wee493
Forum Newbie
Posts: 22
Joined: Sat Sep 06, 2008 3:05 pm

Re: PHP Code that Copies text

Post by wee493 »

8ennett wrote:Yes, my suggestion would be do NOT use the code you have recently discovered. If you do not understand my code (which does NOT even use javascript) then you should try to learn html before taking on the big boys, unless you know how to use the onclick function obviously?

If you haven't a clue what I'm sayin at all then go to google, look up 'PHP 101', and then learn something, next, go to a site that teaches you other languages besides PHP. If you know PHP/Javascript then you'll know what to do! If you know javascript then you don't need my help. If you don't know what either of these para's mean then learn how to program before learning a programming language!
Sorry, I missed your post. I used your code and it worked perfectly! Thank You!
Cut
Forum Commoner
Posts: 39
Joined: Sat Aug 23, 2008 8:01 pm

Re: PHP Code that Copies text

Post by Cut »

8ennett wrote:YIf you do not understand my code (which does NOT even use javascript)
onclick is javascript.
Post Reply