العربيةEspañol日本語한국어中文(简体)РусскийSearch The SiteSupport AADLHelp Login

Logo
 

Submitted by ejk on Wed, 03/05/2008 - 11:47am.

PHP Class Notes

Below is the sample code I created during a PHP class on Tuesday. I'm planning to cover storing and retrieving data from MySQL on Thursday, plus some more practical examples of web applications. If you have any questions or suggestions, log in and comment or send me an email.

<html>
    <head>
        <title>Example</title>
    </head>
    <body>
    <form action="test.php" method="post">
    First Name:  <input type="text" name="first" /><br />
    Last Name: <input type="text" name="last" /><br />
    <input type="submit" name="submit" value="Submit me!" />
		</form>
        <?php
        echo "<p>" . date('l dS \of F Y h:i:s A', time()) . "</p>";
        
        if ($_POST)
        {
        	$first_name = $_POST['first'];
        	$last_name = $_POST['last'];
        
        	if ($first_name == "Eric")
        	{
        		echo "Authorized User: ";
        	}
        	else
        	{
        		echo "Unauthorized User: ";
        	}
        	echo $first_name . " " . $last_name ;
        
        	echo "<pre>";
        	var_dump($_POST);
        	echo "</pre>";
        
        	echo "<table border=1>";
        	foreach($numbers as $number)
        	{
        		echo "<tr><td>" . $number . "</td></tr>";
        	}
        	echo "</table>";
        }
        ?>
    </body>
</html>

login or register to post comments