spacer.png, 0 kB
spacer.png, 0 kB
Home arrow PHP arrow PHP if/else alternative HTML code
PHP if/else alternative HTML code PDF Print E-mail
 
PHP is so direct and simple that allows with just some instructions to create dynamic pages mainly using HTML code. We are referring to HTML pages with some simply php instructions changing content upon conditions verification..

The HTML page in the example here below welcomes the user with a sentence based on the time. We are using the date() function that returns information about date and time (and in our case, with the 'a' string parameter, the am or pm statement is returned).
<html>
Welcome to

<?php if (date("a")=="am") : ?>
good morning<br>
did you just wake up???

<?php else: ?>
good afternoon<br>
(or good evening)

<?php endif ?>

<br>
Thanks for having chosen our site
</html>
Last Updated ( sabato, 01 dicembre 2007 )
 
< Prev
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB