0
Help with running PHP
Say I have a html, css, and a JavaScript file in a folder working together. How would I add a php file in so I could use php in my html filel.
1 Answer
0
You can connect your HTML/HTML form. Your html (code ) ex.:form , from php code using the print command ex.: print ("<table><tr><td>......."); and recall the same to retrieve form parameter via get or post form (recurrent call) , also is possible pass the hidden form variables to control the procedure.Â
in PHP use @$_POST or @$_GET["????"] ->???? = var name of form passing value.
ex.: if (@$_POST["submit"] <> "") { ->"send form via submit html form button"
Note : Php is ejecuted in server, html and javascript in browser
To pass data session use $session ( control session parameters ) or cokkies to mantaint data in browser client and use Jscript to retrieve this.Â
ex.: if (@$_SESSION[parametername] == "" -> "control one sesion parameter"
---------example--------------------
<form action="login.php"Â method="post"Â >
<tr>
    <td><span class="xxxx">User Name</span></td>
 <td><span class="xxxx"><input type="text" name="username" id="username"size="20" value="default value"></span></td>
   </tr>
    <tr>
       <td><span class="xxxx">Password</span></td>
        <td><span class="xxxx"><input type="password" name="password"id="password" size="20"></span></td>
    </tr>
    <tr>
</form>
in this case you retriveve with :
login.php
<?php
if (@$_POST["submit"] <> "") {
// Setup variables
$Username = @$_POST["username"];
$Password = @$_POST["password"];
 }
?>
@Username and $Password = values entered in form