PHP echo within form

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
mrlayance
Forum Commoner
Posts: 31
Joined: Mon Dec 07, 2009 11:53 am

PHP echo within form

Post by mrlayance »

If I do <?php echo curPageURL(); ?> the url displays fine. I can not figure out how to make this work within a form that is echoed.

Code: Select all

echo "<form action=\"\">";
echo "<textarea readonly=\"readonly\" onclick=\"this.focus();this.select()\" rows=\"2\" cols=\"40\" style=\"overflow:hidden;\"><?php echo curPageURL(); ?></textarea>";
echo "</form>";
Thanks for the help.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP echo within form

Post by requinix »

I've never understood why people think that kind of code should work.

Sorry, but I'm at a loss for words to describe why your thought process is incorrect.

Code: Select all

echo "<form action=\"\">";
echo "<textarea readonly=\"readonly\" onclick=\"this.focus();this.select()\" rows=\"2\" cols=\"40\" style=\"overflow:hidden;\">";
echo curPageURL();
echo "</textarea>";
echo "</form>";
mrlayance
Forum Commoner
Posts: 31
Joined: Mon Dec 07, 2009 11:53 am

Re: PHP echo within form

Post by mrlayance »

Alot of things escape me, thanks.
Post Reply