How to intersperse PHP with HTML
Hi,
I have a site which will have, for example, a login system where people have to enter their usernames and passwords, depending on which they'll be let in to the site. So, in code, I've got a line like: if ($_POST['password'] == $password) { then do whatever } else { print "Wrong password" ; ) My problem is, this "Wrong password" printing is just a solitary line, not keeping with the colours and style of the site, and it looks very bad. I want to ideally, output some HTML, which will have a picture, and print the "Wrong password" in the font and colours I desire. How do I do this? Do I have to put all the HTML in a print statement, and then deal with the nightmare of escaping all the quote marks in it with a "\"? Or is there a cleaner method to the whole thing? Maybe something like this - if ($_POST['password'] == $password) { then do whatever } else ?> <FONT SIZE=2> Wrong password </FONT> Thanks for your help. |
Hi -
One possibility: Code:
<?php Code:
<?php Don't use "<FONT>" tags, if you can avoid it. IMHO, CSS is much better... |
Aah so I was right then, in my 2nd snip of code....? :) Thanks a lot, 14moose. Anybody else got any comments?
|
You can include (or require) a file which holds the html formatting that you desire.
|
Quote:
<?php ?> code for HTML code, hence I usually write this way, which is a 3rd option to do :) Code:
<?php |
All times are GMT -5. The time now is 07:09 PM. |