Page 1 of 1

Hide php code in html includes?

Posted: Sun Apr 23, 2006 3:34 pm
by RickH
I'm creating a series of registration forms for an organization that does their own site maintenance. I've separated the html from the php as much as I can, but I do need some php in the html include to make the form "sticky" and color the labels of any missing fields. (I could put it in with DOM scripting, but if JavaScript is turned off...)

The problem is that the php code shows up in the visual editor they use for maintenance (FrontPage). Is there any way to hide it so that it doesn't appear. I've tried using asp-style tags and <script> tags, commenting it with html comments and putting it in as CDATA. Nothing seems to work. I don't want them erasing parts of my code that appear in "Normal" view (which is what you would see if you opened the include in IE).

Also, my code that works for "stickiness" in the <input>s doesn't work in the <textarea>. Any idea why?

Code: Select all

<?php if (isset($_POST['howfound'])) echo $_POST['howfound']; ?>
Rick

Posted: Mon Apr 24, 2006 2:00 am
by andym01480

Code: Select all

<?php if (isset($_POST['howfound'])) {echo $_POST['howfound'];} ?>
missing {}!

Posted: Mon Apr 24, 2006 9:18 am
by RickH
Oops, my mistake on the second question. <textarea> does not have a "value" attribute. :oops: I realized it as soon as I validated the form. (I don't do many forms.) Sorry.

Rick

Posted: Mon Apr 24, 2006 10:33 am
by shiznatix
first off, you don't have to use the { and } in that situation. if its only 1 line of code being run off a if statement then you don't need em.