Form that writes to a CMS table

11 posts by 5 authors in: Forums > CMS Builder
Last Post: May 21, 2011   (RSS)

By zip222 - February 22, 2011

Is it complicated to setup a form that writes to a CMS table? I would like to collect information from visitors via a form and then display it on the site.

Re: [zip222] Form that writes to a CMS table

By JeffC - February 22, 2011 - edited: February 22, 2011

I think the file 'addForm.php' should do what you need. I have attached it for you
Jeff
Attachments:

addform_010.php 3K

Re: [Jeffncou] Form that writes to a CMS table

By zip222 - February 22, 2011

Thanks, that is what what I am looking for. Though... it works fine if I leave the code exactly as is. But if I try to add another field I am getting an "undefined index" error for each field that i try to add. it seems fairly straightforward what i need to update, but it is not working. any thoughts?

Re: [zip222] Form that writes to a CMS table

By JeffC - February 22, 2011

Have you added the field in the section editor. It sounds like perhaps the form is calling a field in the db that doesn't exist
Jeff

Re: [zip222] Form that writes to a CMS table

By zip222 - February 22, 2011

Figured it out. I overlooked that I also needed to update the "name" values in the form inputs. I didn't know this add-on existed. It's pretty useful, and easy to implement.

Re: [zip222] Form that writes to a CMS table

By zip222 - May 19, 2011

Any thoughts on how I could some basic spam protection to this? I have read about using a hidden input field for this purpose, but I am not sure how to implement this.

Re: [zip222] Form that writes to a CMS table

By Jason - May 20, 2011

Hi,

One thing you can do is randomly generate 3 numbers using rand(). You can then add them together and store the answer in a hidden field. Finally, you display the 3 numbers: (number1 + number2 + number3 = ) with a text box where they type in the answer. If the answer they enter matches you hidden field, it's a valid entry. Otherwise, the page reloads and 3 new numbers are generated.

This is a far from fool proof method, but it could help get you started.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [zip222] Form that writes to a CMS table

By northernpenguin - May 21, 2011

You might also want to install a captcha

http://www.google.com/recaptcha/captcha
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Form that writes to a CMS table

By zip222 - May 21, 2011

I am trying to use a system that doesn't require the user to enter anything. I read about methods that a field that is hidden to the user, but is "visible" to bots, and therefore tricks the bot into entering a value. The error checking looks at this field and then rejects the entry if anything is entered into the field.