PHP Classes

File: fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1001_JS_vs_PHP.php

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1001_JS_vs_PHP.php   Download  
File: fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1001_JS_vs_PHP.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of fwphp/glomodul/z_examples/AJAX_form_valid/ajax/1001_JS_vs_PHP.php
Date: 1 year ago
Size: 1,173 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <title>1001 Basic JavaScript Syntax</title>

  <link rel="stylesheet" type="text/css" href="css/basic_2.css" />

</head>

<body>

<div>
  <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <p>
      Enter First Name:<br />
      <input type="text" name="firstname" id="firstname" size="30" />
      </p>


      <p>
      <input type="submit" value="Display Message" />
      <input type="reset" />
      </p>
  </form>
</div>

<div id="messagediv">
    <?php
      displayMessage
();
   
?>
</div>


</body>
</html>

<?php

 
function displayMessage()
  {
   
$displayHTML = getFormInfo();

    print
$displayHTML;
  }


  function
getFormInfo()
  {
   
$msg = "<p>Messages:<br />";

    if (isset(
$_POST['firstname']))
    {
     
$firstname = $_POST['firstname'];

     
$firstname_UC = strtoupper($firstname);

      if (
$firstname_UC == 'STEVE')
      {
       
$msg .= "<br />You must be the instructor";
      } else {
       
$msg .= "<br />You must be the student named ".$firstname;
      }
    } else {
     
$msg = "<br />none";
    }

    return
$msg;
  }

?>