Jump to content

Recommended Posts

basically im trying to echo out a line that includes html and links n stuff....im trying to allow the admin to be able to access it without the owner being able to see it....atm im having trouble closing the php correctly.....
please help


<?php

if ($_SESSION['Level']=="Admin") { echo "<a href='add_contactuser1.php'><font color='#000099' size='2' face='Arial, Helvetica, sans-serif'>Add User</font></a><font color='#000099' size='2' face='Arial, Helvetica, sans-serif'>";

}
?>





Link to comment
https://forums.phpfreaks.com/topic/28617-echoing-out-html-code-for-a-log-in-page/
Share on other sites

when im typing it up in edit plus....the closing '?>' doesnt seem to be the same colour as the opening '<?php'....Editplus notifies by colour if code has been closed and opened by using colour.....also the start of '<a href' also looks like it isnt being recognised as the '<' is colourless.....
Try it like this:
[code]
<?php

if ($_SESSION['Level']=="Admin") {
?>
<a href='add_contactuser1.php'><font color='#000099' size='2' face='Arial, Helvetica, sans-serif'>Add User</font>[/url]<font color='#000099' size='2' face='Arial, Helvetica, sans-serif'>
<?
}
?>
[/code]
Malcerous has it right, but your original code should work fine too.

Edit Plus just sees a '<' symbol and looks for the next '>' symbol, which it treats as the end of the tag. Any additional '<' symbols in between will be seen as text rather than as a new tag.

So when you type

<?php echo "<A Href='foo'>" ?>

...edit plus sees this as a tag:

[color=red]<?php echo "<A Href='foo'>[/color]

...and this as faulty syntax: [color=blue]" ?>[/color]

iow, it's not php- or javascript-ready program. If you want it to show your tags properly, close the php tag before starting your html, like Malcerous did.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.