PHP Classes
elePHPant
Icontem

File: basicUsage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Javier Flores Ibarra  >  formAt  >  basicUsage.php  >  Download  
File: basicUsage.php
Role: Example script
Content type: text/plain
Description: Basic Example
Class: formAt
Generate forms to edit data in MySQL tables
Author: By
Last change:
Date: 7 years ago
Size: 7,824 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>--:.formAt.:--</title>


<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.style1 {
    font-family: Arial, Helvetica, sans-serif;
    color: #999999;
    font-size: 12px;
}
.fieldStyle {
    font-family: Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#999999;
    border:solid 1px #CCCCCC;
    width:200px
}

.radioCheckStyle {
    font-family: Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#999999;
    width:200px
}
.style2 {
    color: #FFFFFF;
    font-size: 18px;
}
.style4 {font-size: 24px}

-->
</style>
</head>

<body>
<p align="center"><a href="index.html"><img src="logo.gif" width="335" height="67" border="0" /></a></p>
<?
include("config.php");

// INCLUDE CLASS
include("formAt.class.php");
// DECLARE AND INITIALIZE OBJECT
$formAt = new formAt(true,$host,$login,$password,$database);

?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td width="78%" valign="top"><form id="formAt" name="formAt" method="post" action="">
      <table width="529" border="0" align="center" cellpadding="2" cellspacing="2" style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#999999">
        <tr>
          <td colspan="2" align="right" valign="top" bgcolor="#B4B4B4"><span class="style2"><span class="style4">.Basic Usage</span> | <a href="advanceUsage.php" style="color:#333333">.Advanced Usage </a></span></td>
        </tr>
        <tr>
          <td width="199" align="right" valign="top">Customer Name </td>
          <td width="316">
          <?
       
// Generate textfield
       
echo $formAt->genStrField("car_rental", // table
                                 
"customer_name" // column
                                 
);
       
?>
<br />
          <div align="left">
            <pre style="font-size:9px">
          // Generate textfield<br />echo $formAt-&gt;genStrField(&quot;car_rental&quot;, // table<br /> &quot;customer_name&quot; // column<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top" bgcolor="#EAEAEA">Rent Mode </td>
          <td bgcolor="#EAEAEA"><?
       
// Generate radio set from enum colum (Automatically selected the default value in column)
       
echo $formAt->genEnumSetField("car_rental", // table
                                     
"rent_mode" // colum
                                     
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate radio-set from enum column <br />//(Automatically selected the default value in column)<br />echo $formAt-&gt;genEnumSetField(&quot;car_rental&quot;, // table<br /> &quot;rent_mode&quot; //column<br />);</pre>
            </div>
            </td>
        </tr>
        <tr>
          <td align="right" valign="top">Credit Card </td>
          <td><?
       
// Generate checkbos set from set colum
       
echo $formAt->genEnumSetField("car_rental", // table
                                     
"credit_card", // colum
                                     
"radioCheckStyle", // css style
                                     
"checkbox" // object type
                                     
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate checkbox-set from set column <br />echo $formAt-&gt;genEnumSetField(&quot;car_rental&quot;, // table<br /> &quot;credit_card&quot;, // column<br /> &quot;radioCheckStyle&quot;, // css style<br /> &quot;checkbox&quot; // object type<br /> );</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top" bgcolor="#EAEAEA">Service Description </td>
          <td bgcolor="#EAEAEA"><?
       
// Generate textarea
       
echo $formAt->genStrField("car_rental", // table
                                 
"service_description" // column
                                 
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate textarea<br />echo $formAt-&gt;genStrField(&quot;car_rental&quot;, // table<br /> &quot;service_description // column<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top">Price</td>
          <td><?
       
// Generate textfield and get the column's default value
       
echo $formAt->genStrField("car_rental", // table
                                 
"price" // column
                                 
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate textfield and retrive the column's default value<br />echo $formAt-&gt;genStrField(&quot;car_rental&quot;,// table<br /> &quot;price&quot; // column<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top" bgcolor="#EAEAEA">Pick-up Time </td>
          <td bgcolor="#EAEAEA"><?
       
// Generate textfield and because it's a date column the default value is the current time
       
echo $formAt->genStrField("car_rental", // table
                                 
"pickup_time" // column
                                 
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate textfield and because it's a date column the<br />//default value is the current time <br />echo $formAt-&gt;genStrField(&quot;car_rental&quot;, // table<br /> &quot;pickup_time&quot; //column<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top">Drop-off Time </td>
          <td><?
       
// Generate textfield and now we don't want the current time
       
$formAt->defaults(false); // Stop giving me automatic default values
       
echo $formAt->genStrField("car_rental", // table
                                 
"dropoff_time" // column
                                 
);
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate textfield and now we don't want the current time <br /> $formAt-&gt;defaults(false); // Stop giving me automatic default values<br /> echo $formAt-&gt;genStrField(&quot;car_rental&quot;, // table<br /> &quot;dropoff_time&quot; // column<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top" bgcolor="#EAEAEA">Car</td>
          <td bgcolor="#EAEAEA"><?
       
// Generate a select object based on table
       
$formAt->setSelectIniLabel("Select a Car"); // Set the first option label for information
       
echo $formAt->genCatalogueField("cars", // table
                                       
"car_id", // column for value
                                       
"car" // column for label
                                       
);
       
       
       
?>
<br />
            <div align="left">
              <pre style="font-size:9px">// Generate a select object based on table<br />$formAt-&gt;setSelectIniLabel(&quot;Select a Car&quot;); // Set the first option<br />echo $formAt-&gt;genCatalogueField(&quot;cars&quot;, // table<br /> &quot;car_id&quot;, //column for value<br /> &quot;car&quot; // column for label<br />);</pre>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top">&nbsp;</td>
          <td><input name="Reset" type="reset" class="fieldStyle" style="width:100px" value="Reset" />
              <label>
              <input name="Submit2" type="submit" class="fieldStyle" style="width:100px" value="Submit" disabled="disabled" />
            </label></td>
        </tr>
      </table>
            </form>
    <p class="style1">&nbsp;</p>
    </td>
  </tr>
</table>
<?
   
// close mysql connection
   
$formAt->closeDBConnection();
?>

<p>&nbsp;</p>
</body>
</html>