Beispiel #1
0
    {
        $this->AddOutput("<p><i>DoSubmit(): Form was submitted. Do stuff (save to database) and return true (success) or false (failed processing form)</i></p>");
        $this->AddOutput("<p><b>Name: " . $this->Value('name') . "</b></p>");
        $this->AddOutput("<p><b>Email: " . $this->Value('email') . "</b></p>");
        $this->AddOutput("<p><b>Phone: " . $this->Value('phone') . "</b></p>");
        $this->saveInSession = true;
        return true;
    }
}
// -----------------------------------------------------------------------
//
// Use the form and check it status.
//
session_name('cform_example');
session_start();
$form = new CFormContact();
// Check the status of the form
$status = $form->Check();
// What to do if the form was submitted?
if ($status === true) {
    $form->AddOUtput("<p><i>Form was submitted and the callback method returned true.</i></p>");
    header("Location: " . $_SERVER['PHP_SELF']);
} else {
    if ($status === false) {
        $form->AddOutput("<p><i>Form was submitted and the Check() method returned false.</i></p>");
        header("Location: " . $_SERVER['PHP_SELF']);
    }
}
?>

Beispiel #2
0
    /**
     * Callback for submitted forms
     */
    protected function DoSubmit()
    {
        echo "<p><i>DoSubmit(): Form was submitted. Do stuff (save to database) and return true (success) or false (failed processing form)</i></p>";
        return true;
    }
}
// -----------------------------------------------------------------------
//
// Use the form and check it status.
//
session_name('cform_example');
session_start();
$form = new CFormContact();
// Check the status of the form
$status = $form->Check();
// What to do if the form was submitted?
if ($status === true) {
    echo "<p><i>Form was submitted and the callback method returned true. I should redirect to a page to avoid issues with reloading posted form.</i></p>";
}
?>


<!doctype html>
<meta charset=utf8>
<title>Example on using forms with Lydia CForm</title>
<!-- Echo out the form -->
<h1>Example on using forms with Lydia CForm</h1>
<?php 
Beispiel #3
0
    /**
     * Callback for submitted forms
     */
    protected function DoSubmit()
    {
        echo "<p><i>DoSubmit(): Form was submitted. Do stuff (save to database) and return true (success) or false (failed processing form)</i></p>";
        return true;
    }
}
// -----------------------------------------------------------------------
//
// Use the form and check it status.
//
session_name('cform_example');
session_start();
$form = new CFormContact();
?>


<!doctype html>
<meta charset=utf8>
<title>CForm Example: Basic example on how to use CForm (part 1)</title>
<h1>CForm Example: Basic example on how to use CForm (part 1)</h1>
<?php 
echo $form->GetHTML();
?>

<?php 
$footer = "footer_mos.php";
if (is_file($footer)) {
    include $footer;