<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>autoformBQ-Sample</title> <link rel="stylesheet" type="text/css" href="autoformBQ.css"> </head> <body> <div align="center">
<? require_once("autoformBQ.php");
function print_flags( $flag ) // to show the flags after a submit-button "safe" { // print flags // echo " value = $flag: --> "; if ($flag & 1) echo "not_null, "; if ($flag & 2) echo "primary_key, "; if ($flag & 16) echo "auto-increment, "; if ($flag & 4) echo "unsigned, "; if ($flag & 8) echo "zerofill, "; if ($flag & 32) echo "multiple_key, "; if ($flag & 64) echo "enum, "; if ($flag & 128) echo "set, "; if ($flag & 256) echo "blob/text, "; if ($flag & 512) echo "binary, "; }
// on button "save", show the params if (isset($_POST["submit"]) && $_POST["submit"] == "Save") { // nothing to do in case of a restore-button // The form ist shown again as before echo "</div>"; // no centered output after submit foreach ($_POST as $k => $v) { echo ,"<br><br>Name: $k<br>Content: "; if ( is_array($v)) $content = implode(",",$v); else $content = $v; echo $content;
if ($c) // not the first arg ( The form-type ) { echo ,"<br>the field-flags: "; // get the flag from field-name $arr = explode(",",$k); print_flags($arr[3]); } $c++; } // a button echo "<br>"; echo " <form > <input type=\"button\" value = \"Back to the forms\" onclick=\"history.back()\"> </form>"; exit; }
/* Add your values here */ $db_server = "localhost"; $db_database = "serv"; $db_user = "root"; $db_password = "";
$conn = @mysql_connect($db_server,$db_user,$db_password); if (!$conn) die("no DB-connection"); mysql_select_db($db_database);
// define your query here // $sql = 'SELECT test.* , test2.* FROM test , test2 WHERE test.id = test2.id2'; $sql = "select * from test where 1"; // execute it $result = mysql_query($sql); if (!$result) die("<br>oops, an error occured<br>");
// create the form-object $form = new autoformBQ($conn,$result,$PHP_SELF);
echo "<h2>\"new\"-form with default settings: </h2>"; // print the standard-form $form->print_form(); echo "<br>";
// define a Headline and a footline $form->headline("<font color=\"#1A9302\"><h3>This is the form with Headline</h3>because it is a \"edit\"-form now, it shows the current record-content</font>"); $form->footline("and a footline"); // change to edit-mode $form->bFormEdit = TRUE; $form->print_form(); echo "<br>";
// check the layout with showPatternAsDefault and showPatternAsHint $form->showPatternAsDefault(); $form->showPatternAsHint(); $form->headline("Form with real-column patterns as default value and as hint"); $form->footline(""); $form->bFormEdit = FALSE; $form->print_form(); echo "<br>";
// dont show patterns again $form->showPatternAsDefault(FALSE); $form->showPatternAsHint(FALSE);
// tell your user, which input is required ( not_null columns ) $form->markRequiredInput(); $hl = "In this form you show your user which columns require input<br>" ."you can change the appearance by altering \"strSignInputRequired\" at the lang-file"; $form->headline($hl);
echo "<br>"; $form->markRequiredInput(FALSE);
// example form with css $form->css_class("autoformBQ"); $hl = "Here you see the same form using CSS<br>" ."I know, the colors arent everyone's favor, it is only a example"; $form->headline($hl); $fl = "Thats enough, try to edit some input-tags in a form and press \"Save\", \"Reset\", or \"Restore\"" ."<br>No need to be afraid about save, only the current tag-content will be shown"; $form->footline($fl); $form->print_form(); ?> <br><br><br> I hope, the autoformBQ-Class is useful to you. Bugreport, hints and suggestions are welcome. </div> </body> </html>
|