I'm a front end dev, so my PHP is a bit lacking and I'm stuck.
I'm trying to write some data from a form into the Joomla database.
It's only an email address so not complicated. I've created a form and a table in the database to hold the email addresses. However I can't get it to write to the database and I'm not sure what I'm missing.
I'm not sure what classes I need to include in my code. I'm including joomla/factory so I'm not getting an error telling me the JFactory is not an object, but I don't know if I need to include anything else.
Here's my PHP code:
$emailAdd = $_POST['email'];
require_once ('../../libraries/joomla/factory.php');
$db =& JFactory::getDBO();
$query = "INSERT INTO '#__pdfemails' ('emailaddress')
VALUES ('thevalue')";
$db->setQuery($query);
$db->query();
I don't get any kind of error at all, but it's not writing to the database.
Can anyone help please?