Page 1 of 1

PHP echo within form

Posted: Fri Aug 06, 2010 7:46 am
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.

Re: PHP echo within form

Posted: Fri Aug 06, 2010 8:06 am
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>";

Re: PHP echo within form

Posted: Fri Aug 06, 2010 8:49 am
by mrlayance
Alot of things escape me, thanks.