Open rlynjb opened 7 years ago
Hi Could you please provide me your database configuration in the process part of your form settings?
Thx
I'm having the same error, my db config is this:
- database:
db: grav
table: contacts
fields: { name: name, email: email, message: message }
Thanks
Could you please provide me the exact error message. and where you get this.
Whoops \ Exception \ ErrorException (E_NOTICE) Undefined variable: fieldnames
Here's a zip file with the whole thing if that helps error file
Thanks for the infos. I guess it is an bug.
Workaround Add the following line after line 83 in the file /user/plugins/form-database/form-database.php:
$fieldnames = "";
Now I get
Undefined index: name
And it's pointing to line 110 of the plugin
$fieldvalues = "('" . $_POST[$val] ."'";
I'm testing it at the weekend.
I've found the problem.
The form plugin is generating the fields using the following:
form:
fields:
- name: name
But the fields are coming up in the form as:
<input name="data[name]" value="" type="text">
So $_POST[$val]
wasn't finding anything, I've changed it to $_POST['data'][$val]
and it works now.
I don't know if this was a change in the form plugin or if it's going to be permanent, but at least I've got it working.
Just to say a big thanks to ramono — your edit seems to work, I was encountering the exact same issue... would be a great help if the grav-hosted plugin is updated...
also for me, had to make the edit suggested by @ramono.
I made a PR
Edit: I am not sure this is needed, there is {% set scope = scope ?: 'data.' %}
in the form.html.twig
Hi guys, Idk if this is a bug inside of plugin but I kept getting this error.. it seems like variable fieldnames is undefined.. Im looking at code and i dont know where fieldnames is defined