Hide php code in html includes?

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
RickH
Forum Newbie
Posts: 2
Joined: Sun Apr 23, 2006 3:14 pm

Hide php code in html includes?

Post 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
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post by andym01480 »

Code: Select all

<?php if (isset($_POST['howfound'])) {echo $_POST['howfound'];} ?>
missing {}!
RickH
Forum Newbie
Posts: 2
Joined: Sun Apr 23, 2006 3:14 pm

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
Post Reply