<?php /* * CONTACT FORM EXAMPLE FOR PTCFORMS.PHP CLASS * REMOVE COMMENT FROM LINE 28 FOR UI-PLUGINS */ ### PARAMATERS FOR THE EXAMPLE ################ $email_address = '*****@*****.**'; $mail_subject = 'TEST CONTACT FORM'; ######################################### /* INITIALIZE THE CLASS WITH SOME OPTIONS */ $options = array('add_class_validator' => true, 'form_width' => '400px', 'labels_align' => 'right', 'spacer_height' => '10px'); require_once '../PtcForm.php'; $form = new PtcForm($options); echo '<!DOCTYPE html><html><head>'; /* (OPTIONAL) INCLUDE JS FOR JQUERY VALIDATOR AND UI STYLES PLUGINS */ //require_once("ptcforms-ui-plugins.php"); /* MINIMAL CSS FOR THE EXAMPLE */ echo '<style> body{font:normal .85em "trebuchet ms",arial,sans-serif;color:#555;} input[type=text], select, textarea{width:220px;} .errMsg{color:red;} </style>'; /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'ct_firstname', 'label' => 'Firstname:*', 'validate' => 'required')); /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'ct_lastname', 'label' => 'Lastname:*', 'validate' => 'required')); /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'ct_email', 'label' => 'Your email:*', 'validate' => array('required', 'email'))); /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'ct_phone', 'label' => 'Your phone:*', 'validate' => 'required'));
if (@$_COOKIE['cookname'] && @$_COOKIE['cookpass']) { $_POST['lg_username'] = $_COOKIE['cookname']; $_POST['lg_password'] = $_COOKIE['cookpass']; if ($valid_login = check_login()) { $_SESSION['loggedIn'] = true; } } if (@$_SESSION['loggedIn']) { header('Location: ' . $redirect_page); exit; } $_SESSION['loggedIn'] = false; /* INITIALIZE THE CLASS WITH SOME OPTIONS */ $options = array('add_class_validator' => true, 'keep_values' => false, 'labels_align' => 'right', 'form_width' => '415px', 'spacer_height' => '10px;'); require_once '../PtcForm.php'; $form = new PtcForm($options); echo '<!DOCTYPE html><html><head>'; /* (OPTIONAL) INCLUDE JS FOR JQUERY VALIDATOR AND STYLES */ //require_once("ptcforms-ui-plugins.php"); /* MINIMAL CSS FOR THE EXAMPLE */ echo '<style> body{font:normal .85em "trebuchet ms",arial,sans-serif;color:#555;} #loginForm input[type=text], input[type=password]{width:237px;} .errMsg{color:red;} </style>'; /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'lg_username', 'label' => 'Username:'******'validate' => 'required')); /* ADDING A PASSWORD FIELD */ $form->addElement(array('type' => 'password', 'name' => 'lg_password', 'label' => 'Password:'******'validate' => array('required', 'check_login'))); /* ADDING A CHECKBOX */ $checkbox = array('type' => 'checkbox', 'name' => 'lg_keep_login', 'label' => 'Remember me', 'parentEl' => array('style' => 'text-align:right;'));
<?php /* * REGISTRATION FORM EXAMPLE FOR PTCFORMS.PHP CLASS * REMOVE COMMENT FROM LINE 21 FOR UI-PLUGINS */ /* INITIALIZE THE CLASS WITH SOME OPTIONS */ $options = array('add_class_validator' => true, 'form_width' => '500px', 'spacer_height' => '10px;'); require_once '../PtcForm.php'; $form = new PtcForm($options); echo '<!DOCTYPE html><html><head>'; /* (OPTIONAL) INCLUDE JS FOR JQUERY VALIDATOR AND STYLES */ //require_once("ptcforms-ui-plugins.php"); /* MINIMAL CSS FOR THE EXAMPLE */ echo '<style> body{font:normal .85em "trebuchet ms",arial,sans-serif;color:#555;} input[type=text], input[type=password]{width:220px;} .errMsg{color:red;} </style>'; /* ADDING A SPACER */ $form->addElement(array('type' => 'custom', 'name' => 'spacer1', 'value' => $form->addSpacer('3px'))); /* ADDING A TEXT FIELD */ $form->addElement(array('name' => 'reg_name', 'label' => 'Username:*', 'validate' => 'required')); /* ADDING A PASSWORD FIELD */ $form->addElement(array('type' => 'password', 'name' => 'reg_password', 'label' => 'Password:*', 'validate' => 'required')); /* ADDING A PASSWORD FIELD */ $form->addElement(array('type' => 'password', 'name' => 'reg_password1', 'label' => 'Confirm Password:*', 'validate' => array('required', 'equalTo' => 'reg_password'))); /* ADDING A TEXT FIELD */ $form->addElement(array('type' => 'text', 'name' => 'reg_email', 'label' => 'Email Address:*', 'validate' => array("required", "email"))); /* ADDING A FIELDSET AS CONTAINER FOR THE PREVIOUS FIELDS */ $form->addElement(array('type' => 'fieldset', 'name' => 'reg_fieldset', 'label' => 'User Registration Form', 'values' => array('spacer1', 'reg_name', 'reg_password', 'reg_password1', 'reg_email'), 'attributes' => array('style' => 'padding:10px;')));