Insert rows into any MySQL database table using a form.
Warning
If you are using this module in external mode, that is, to insert data into a database other than the EE installation’s own, do not make the form public, as it displays the target database user’s password in the HTML.
Compatibility
The module is compatible with ExpressionEngine v1.x.
Parameters
Required parameters
Table
The database table in which to insert the data.
Optional parameters
Database
The database parameter is required only if inserting into a table on an external database. In this scenario the hostname, password and username parameters are also required.
Hostname
The hostname parameter is required only if inserting into a table on an external database. In this scenario the database, password and username parameters are also required.
Password
The password parameter is required only if inserting into a table on an external database. In this scenario the hostname, database and username parameters are also required.
Return
The URL to which the form will return. if empty, the form returns to the same page.
Username
The username parameter is required only if inserting into a table on an external database. In this scenario the hostnmae, database and password parameters are also required.
Examples
{exp:external_saef:form
hostname="www.someauctionhouse.com"
database="someauctionhouse_auctions"
username="auctioneer"
password="good1es"
table="bids"
return="/log-bids/{segment_2}/{segment_3}/bid-logged"
}
<p><b>Auction #{segment_2}</b></p>
<p><input type="hidden" name="bids_auction" value="{segment_2}" /></p>
<p><b>Lot #{segment_3}</b></p>
<p><input type="hidden" name="bids_lot" value="{segment_3}" /></p>
<p><b>Bidder</b></p>
<p><input type="text" name="bids_bidder" value="" /></p>
<p><b>Amount</b></p>
<p><input type="text" name="bids_amount" value="" /></p>
<p><input type="submit" value="Log Bid" /></p>
{if segment_4=="entry-added"}
<p id="entry-added" >Bid logged</p>
{/if}
{/exp:external_saef:form}
Changelog
v1.0.1 (2010 Apr 11)
- Added SQL Injection Prevention for all parameters as security measure
Roadmap
- add profiles via the module’s control panel screen so that external db’s need not have their username and password exposed
- enable update as well as insert
- make compatible with EE v2.x
Mon 10 Jan ’11
12:38pm
Adam Khan
Vee, six months later, all I can say is I’ll get to it one of these days.
Mon 28 Mar ’11
4:33pm
Jim
Adam, I’m using a local database. As soon as I use this module in my template, my page blanks out. Also I wasn’t sure where to install the module files, so I created a folder “external_saef” in modules. Any ideas? Thanks!
Mon 28 Mar ’11
9:18pm
Jim
I think I figured it out. I added $DB to the global vars in the form function (line 42).
Wed 14 Sep ’11
9:05pm
Dmitry
hi Adam! is it EE2 compatible?
Tue 22 Jun ’10
10:30pm
Vee Van Dyke
Would love to see this compatible with EE 2.0. Any idea on when that might occur? (Hint, hint)