Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Sanitize email and insert into table
Hello,
I need to sanitize some form fields (one of them is an email address) and put them into a db table. I’m roaming among the core functions, but can’t get some things…
Some questions:
- is_valid_email for email right?
- Is there any function for creating a table if it does not exists?
- What do I use for sanitizing common text (name, kitten name)?
- upsert for inserting a new row?
Thanks!!
Last edited by Manaus (2014-07-06 18:02:41)
Offline
#2 2014-07-06 23:04:34
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: Sanitize email and insert into table
If you use zem_contact_reborn, it’s zem_contact_email tag will do email validation. And then you’ll also have adi_contact at your disposal to do other forms of validation.
BTW, I’m working on an upgrade to adi_contact to perform database updates – if you’d like to have a go.
One issue that may be a problem: zem_contact is not HTML5, although I think someone’s working on this.
Offline
Re: Sanitize email and insert into table
gomedia wrote #281948:
zem_contact is not HTML5, although I think someone’s working on this.
Yarp. Just gotta get round to fixing the new callback system. If anyone wants to propose any improvements, please get forking.
Scant documentation is here at the moment until I (or someone) gets round to folding it into the plugin. Unfortunately I don’t have the Textiled help available so the current plugin help needs ‘reverse engineering’ from HTML back to Textile, which is a bit of a chore (unless Detextile or HtmlToTextile work these days to give us a head start, or Ruud has the original source files…)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Sanitize email and insert into table
Thanks gomedia,
I’m making a page with a promo code DEAL or something like that, I’m using this code:
<txp:zem_contact to="myemail" thanks="Form was sent, thanks!">
<txp:zem_contact_text label="Nome" name="nome" break="br" />
<txp:zem_contact_email label="Email" name="email" break="br" required="1" />
<txp:zem_contact_text label="Codice" name="promocode" break="br" />
<txp:adi_contact_combo names="promocode" value="DEAL" case_sensitive="1"
require="promocode" message="Use the force!" />
<txp:zem_contact_submit label="Send" />
</txp:zem_contact>
But looks like it’s not working, tried also
<txp:adi_contact_validate names="promocode" type="custom" pattern="DEAL" message="Use a different code please!" />
to no avail…
Any suggestion greatly appreciated, thanks!
Last edited by Manaus (2014-07-07 08:43:05)
Offline
Re: Sanitize email and insert into table
Got it, I’m using pattern="/DEAL/"
Offline
Re: Sanitize email and insert into table
Bloke wrote #281968:
Unfortunately I don’t have the Textiled help available so the current plugin help needs ‘reverse engineering’ from HTML back to Textile, which is a bit of a chore (unless Detextile or HtmlToTextile work these days to give us a head start, or Ruud has the original source files…)
The source files I sent you when I handed over the plugin did contain the original help in Textile format. If you need me to send them again, let me know.
Offline
#7 2014-07-07 23:27:08
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: Sanitize email and insert into table
Manaus wrote #281971:
Got it, I’m using
pattern="/DEAL/"
Glad you got it working. Although it’s not the most user-friendly way of validating simple values! I might look at that …
In the meantime, I’ll contact you off-forum about an adi_contact beta for DB updates.
Offline
Re: Sanitize email and insert into table
@gomedia ok thanks!
Offline
Re: Sanitize email and insert into table
ruud wrote #281976:
The source files I sent you when I handed over the plugin did contain the original help in Textile format.
Right you are indeed. Don’t know how I overlooked that, thanks. I must have installed the plugin instead of using the .php
file.
I’ll convert the code into plugin template format on Github now and merge the existing docs in. Thanks again.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Pages: 1