Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-05-02 04:38:35

Anutosho
New Member
Registered: 2012-05-02
Posts: 2

Newbie: How to handle a form with PHP?

Hi,

I came across Textpattern only today.
A client uses it and wants a form (similar to a contact form).
Some of the form fields and one text outside the form are to be preset with contents from a database. The controlling item is a name parameter in the calling URL (or maybe the URL itself, when using rewrites).

I would be thankfull for any hint where to go from here to get the knowledge together to get that task done.

Basic questions are:
- How can I get hold of the page before it is displayed to add the required text?
- How to receive the sent form data?
- is there a builtin mail fonction in Textarea or do I should I use the standard PHP mail library?

Unfortunately I haven’t even access to the back end yet, but that should be cleared today.

Edit:
when using PHP for page generation (like getting data from a database and add it into the page), where to place the PHP? In an extra file? inline in the template? (son’t like the latter one)

Thanks for reading.

Paul Sommer

Last edited by Anutosho (2012-05-02 04:47:55)

Offline

#2 2012-05-02 05:09:09

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 312

Re: Newbie: How to handle a form with PHP?

Textpattern won’t be able to do all of this ‘out of the box’. However, one of the great things about TxP is that is can be extended through plugins, and there is a very active community of developers here who are always helpful when you’re trying to pull stuff together.

Here are a couple of plugins that might help:

  • adi_gps – really great for pulling values out of the URL. These can then be used within your page structure to alter the appearance based on those values.
  • zem_contact_reborn – a contact form that allows the results of a contact form to be emailed to nominated email addresses.
  • smd_query – this plugin allows you construct basically any SQL query on the TxP database and do something with the resuts. This is extremely powerful.

I think the TxP mail handling is starting to show its age a bit, as I find I get tripped up every now and then with spam handling in Gmail etc. However, if you know some PHP that is quite easily fixed.

In terms of PHP you don’t need it all for basic stuff like displaying content from the database, building lists etc.

Finally, I would strongly recommend reading some of the core Textpattern documentation to get your head around the structure of Textpattern. A little bit of investment now will go a long way to getting up and running (eg. a “form” is not really a form, but more of a code snippet).

Offline

#3 2012-05-09 01:44:30

Anutosho
New Member
Registered: 2012-05-02
Posts: 2

Re: Newbie: How to handle a form with PHP?

Thank you aslsw66.

For now we choose an external solution outside from Textpattern.
Anyway, It is a pretty interesting system and I surely will learn how to use it.

Regards,

Paul

Offline

Board footer

Powered by FluxBB