Sample> FormIsValid


// include TPLN

$TPLN = new TPLN();


// initialiaze record
$TPLN->doQuery("SELECT Name AS text, Code AS value FROM Country");
$options '';
$row $TPLN->DBFetch())
$options .= "<option value=\"{$row['value']}\">{$row['text']}</option>\n";

// value selected ?
$sql "SELECT * FROM Country WHERE Code='".$TPLN->checkQuotes($_GET['Code'])."'";
$row $TPLN->dbFetch();



//$TPLN->notEmpty(array('Continent', 'Region'));
$TPLN->notEmpty('Continent''Continent must be filled');
$TPLN->notEmpty('Region''Region must be filled');

// here one test if the form is valid or not, the parameter allows us to keep the data seized by the user
// treatment
    // bloc form_validate is displayed automatically


    <title>form is valid</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../style.css" rel="stylesheet" type="text/css" />

<h1>Automatic initialize an html form directly by a php array</h1>

<form action="" method="post" name="form">
<table cellspacing="1" cellpadding="3" style="border:1px solid black; background-color:#FFFFFF;">
    <td colspan="2" align="left" bgcolor="#CCCCCC">
    <select name="Code" id="Code" onChange="document.location.href='?Code='+this.value">

      <option value="">Choose your country</option>

    <td>Continent : </td>
        <select name="Continent" id="Continent">
            <option value="">Please Select</option>
            <option value="Asia">Asia</option>
            <option value="Europe">Europe</option>
            <option value="North America">North America</option>
            <option value="Africa">Africa</option>
            <option value="Oceania">Oceania</option>
            <option value="Antarctica">Antarctica</option>
            <option value="South America">South America</option>

    <td>Region : </td>
        <input type="text" name="Region" id="Region" value="">

    <td colspan="2" align="center"><p>
        <input type="submit" value="   Send   ">

<div id="form_valid">
    Your form was submitted without errors ! And replaced by bloc form_valid ! <br>

{_Logo}<font size="1"> in {_Chrono} s<br>
Queries executed: {_QueryCount}</font>