Jump to content

Echoing out HTML code for a log-in page...


dubt2nv

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.