Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49c213a

Browse files
committed
Add documentation
1 parent 76f5ad8 commit 49c213a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

‎README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
11
# Database Form
2+
23
PHP example demonstrating how to post form data into a MySQL database and display it.
4+
5+
**NOTE**: This is only one of many methods one may want to do this. Please research further to see if this example suits your needs.
6+
7+
## Requirements
8+
9+
* PHP ~v5.6+
10+
* PDO extension enabled
11+
* MySQL ~v5.6+
12+
13+
**NOTE**: These are the version the example has been tested under.
14+
15+
## Setup
16+
17+
* Configure `config.php` to meet your own mysql connection parameters.
18+
* Create a database with the same name as the constant `DB` (default: **php-db-form**) in `config.php` and import `database.sql` to it.
19+
20+
## How it works ?
21+
22+
This is easy. The `index.php` connects to the database and loads all emails within the table `emails` and displays them.
23+
Additionally there is a input field, where new emails can be appended to the `emails` table.
24+
25+
When a new email added, the form is submitted to `actions.php` where the action `add` is mapped to connect to the database and insert a new email in the `emails` table.
26+
If an error occurs, then the script redirects back to `index.php` with an `error` GET parameter, containing an error message.
27+
28+
## Troubleshooting
29+
30+
If you are having any troubles, create an issue here on GitHub.
31+
32+
## Licence
33+
34+
[The BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) (BSD-3-Clause)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /