Today we learnt about PHP. Is very useful to store data and retrieve it, instead of copying the same code over and over again, and this week we were asked to implement it in our web sites. What I did was create a HTML file of my header, another one of my navigation bar and a third one of my footer, and then, I changed all my pages to .php.
Here is the PHP code I have in one of the pages:
<?php include_once("header.html") ; ?>
<?php include_once("nav.html") ; ?>
<?php include_once("footer.html") ; ?>
Then, in my Reply page, I have something like this:
<?php
echo "<p>" ;
echo "name : ".$_POST["name"] ;
echo "</p>" ;
echo "<p>" ;
echo "e-mail : ".$_POST["email"] ;
echo "</p>" ;
echo "<p>" ;
echo "address : ".$_POST["address"] ;
echo "</p>" ;
echo "<p>" ;
echo "postcode : ".$_POST["postcode"] ;
echo "</p>" ;
echo "<p>" ;
echo "country : ".$_POST["country"] ;
echo "</p>" ;
?>
Is a very useful feature, since it allows to save much time copying and it makes the process of changing a detail in the header for instance much easier and efficient. My Reply page:
1202236.studentplus.abertay.ac.uk/Week100/Index.html
No comments:
Post a Comment