NameSilo

Help Needed! Text Area & HTML Code In PHP

Spaceship Spaceship
Watch

Jake

Senior MemberVIP Member
Impact
56
Basically, I am attempting (and failing) to insert some code that will allow someone to copy and paste code that is generated for them.

Here's an example:

Code:
See how easy it is to copy this?

It allows you to copy everything inside the box, without copying everything else on the page.

I'm doing this in a PHP file, and I'm finding it to be impossible without getting a "Parse Error"

Can anyone help, or put me in the right direction?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
All you need to do is place it within its own div as it is on this forum.

for example:-

HTML:
<div id='text'>See how easy it is to copy this?</div>

Once you have created the div you could always apply css to it so it stands out.
 
1
•••
Jake said:
I'm doing this in a PHP file, and I'm finding it to be impossible without getting a "Parse Error"
If you still get the parse error, post your PHP code and we should be able to help you. As a guess, it may be that you've added a quote character without escaping it. e.g.

PHP:
echo '<div id='text'>See how easy it is to copy this?</div>';
will generate a parse error. To fix it, you need to escape the quotes by putting a backslash before it, like this:

PHP:
echo '<div id=\'text\'>See how easy it is to copy this?</div>';
 
1
•••
Thanks! I got it to work B-)

Rep coming!
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back