Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Anonymous (not verified) on
Is it safe to add a php form to your website?
Comments
php form?
What do you call a php form? Forms are written in HTML, the processing is done by php. If it is safe depends completely on your php code. It's easy to write a script which allows anyone to run queries on your database, or send spam, but that doesn't mean that all forms aren't safe. Why don't you tell us what you want to do, and why you think safety is a concern here?
Thank you for your reply.
Thank you for your reply. :-)
I am developing my site in 6.x. I am calling the form through a taxonomy term so ideally I would just like to add a form in a page.
A simple solution would be to add a standard php form in a page. I just want to make sure that the code won't conflict with the php in Drupal. I hope I was able to explain it a bit more clearly?
You really should consider
You really should consider using to Forms API.
Thank you.
Thank you.
o.k. I looked at the example
o.k. I looked at the example in the API Handbook Forms_api.html:
http://api.drupal.org/api/file/developer/topics/forms_api.html/6
But that didn't work. (When you add print drupal_get_form('contactform', $form); and change test_form to contactform it does work. It prints out a log printout form(?) so don't place in a live site unless you know what you are doing.)
I then found this example at http://drupal.org/node/68265.
But that gave me an error.
I looked at the code and reshuffled the code. But I get the following error:
Fatal error: Cannot use string offset as an array in /url_path/includes/form.inc on line 965
Would anyone be so kind as to help me solve this?
Solved
I looked at the contact module and then tried to build a form from there, but I kept getting errors. So this is something I will have to look at the long term.
The following code snippet adds the normal contact form in a node (page/ story) in 5.x and 6.x:
http://drupal.org/node/236997
I don't know what you want
I don't know what you want to do with your form, but maybe the webform module can also do what you need.