Add a php script to html?

Kitty Juice

New member
in the header of your html index page:
(if you have variables to include in the index page)
<?php
include("login.php");
?>
then the form where they login that will POST the user's input to login, (which you may need to change)
in the body section:
<form name="login" method="POST" action="login.php">
Username:<input type="text" name="username" />
Password:<input type="password" name="password" />
<input type="submit" value="Submit!" />
</form>

This will submit to your login.php page and depending how your login.php works, it will work.
 
Ok, So I have a .php script for a login system, Its all set up, and it links to my MySql, But I dont know how to add that script to my hompage, I know you can link the script if they're both in the same directory and all that, but I don't know the code.
 
in the header of your html index page:
(if you have variables to include in the index page)
<?php
include("login.php");
?>
then the form where they login that will POST the user's input to login, (which you may need to change)
in the body section:
<form name="login" method="POST" action="login.php">
Username:<input type="text" name="username" />
Password:<input type="password" name="password" />
<input type="submit" value="Submit!" />
</form>

This will submit to your login.php page and depending how your login.php works, it will work.
 
You don't have to link anything to anything. If your server or host has PHP running and available (I assume they do), you use the script by placing in your web directory and pointing to it with a browser. If you want it to be the first file a visitor comes to, place it in the web home directory (where you would place the index.html file). Now, you also need to add a configuration change to the web server so that "index.php" is treated as a default file. Most web hosts have this set up already.

If you have "index.html" in the home directory already, just rename it or delete/move it.

You can also keep that file, name the PHP script something like "login.php", and put an HTML link (anchor) that points to that file from the main index.html page.
 
You don't have to link anything to anything. If your server or host has PHP running and available (I assume they do), you use the script by placing in your web directory and pointing to it with a browser. If you want it to be the first file a visitor comes to, place it in the web home directory (where you would place the index.html file). Now, you also need to add a configuration change to the web server so that "index.php" is treated as a default file. Most web hosts have this set up already.

If you have "index.html" in the home directory already, just rename it or delete/move it.

You can also keep that file, name the PHP script something like "login.php", and put an HTML link (anchor) that points to that file from the main index.html page.
 
in the header of your html index page:
(if you have variables to include in the index page)
<?php
include("login.php");
?>
then the form where they login that will POST the user's input to login, (which you may need to change)
in the body section:
<form name="login" method="POST" action="login.php">
Username:<input type="text" name="username" />
Password:<input type="password" name="password" />
<input type="submit" value="Submit!" />
</form>

This will submit to your login.php page and depending how your login.php works, it will work.
 
You don't have to link anything to anything. If your server or host has PHP running and available (I assume they do), you use the script by placing in your web directory and pointing to it with a browser. If you want it to be the first file a visitor comes to, place it in the web home directory (where you would place the index.html file). Now, you also need to add a configuration change to the web server so that "index.php" is treated as a default file. Most web hosts have this set up already.

If you have "index.html" in the home directory already, just rename it or delete/move it.

You can also keep that file, name the PHP script something like "login.php", and put an HTML link (anchor) that points to that file from the main index.html page.
 
Back
Top