How Can I Transfer My Html Webpage Into Php?
Tuesday, February 9th, 2010 at
11:24 pm
I have a username/password section now, is it possible to transfer my html to php with all the graphics and text present?
Filed under: PHP
Like this post? Subscribe to my RSS feed and get loads more!
Yes you can. Here are the steps.
1. Rename .html to .php (eg. “yourpage.html” to “yourpage.php”).
2. Insert php scripts into html page.
eg. …………..
< ?php
...PHP code here......
?>
….HTML code…
You don’t have to transfer anything. Just specify that the content should only be shown when the user/password are correct. For example:
< ?php
...get username and password info from cookies/database/elsewhere...
if(isset($password) && $password == $correct) { ?>
…put HTML here…
< ?php
} else {
echo 'Invalid Username or Password!';
}
?>
Hey dude,
PHP is nothing but scripting language which generated html dynamically. So all you need to do is save file as .php and keep your html code as it is. It will work under apache server.
Your html files can run without apache web server, but to run php you need apache and php environment. so get it install and then use this way to convert normal htl pages.
Well as per as user name and password processing thing is concerned you have to write cookie or database based authentication system