-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbasic.php
More file actions
25 lines (22 loc) · 751 Bytes
/
Copy pathbasic.php
File metadata and controls
25 lines (22 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
require('../SimplePHPForm.php');
$form = new SimplePHPForm();
$form->add('name', 'text', '', ['required'], 'Name', '', 'Your name is required.');
$form->add('email', 'text', '', ['required', 'email'], 'Email', '', 'Your email is required.');
if($form->validate()) // Did the form validate successfully?
{
// Get data: $form->get('name'); ...
// Success ! Send an email or register user in a database somewhere...
$form->reset(); // Reset to default form.
}
?>
<!DOCTYPE html>
<html>
<head>
<title>SimplePHPForm Basic Example</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/simplephpform_default.css" />
</head>
<body>
<?php echo $form->display(); ?>
</body>
</html>