I'm finishing up a form that hopefully will be useful to others.
I'm trying to post data to another table and am having some small snags.
In the Onsubmit box, I am testing the following code:
<p>Thank you {first_name} {last_name} for registering.</p>
<?php
$class = JRequest::getVar('classification', '', 'post');
echo $class;
$db =& JFactory::getDBO();
$query = '
INSERT INTO `#__volunteer_test` (VolunteerID, classification, title)
VALUES("1234", $class, "MD")';
$db->setQuery($query);
$db->query();
The defined variable $class shows up with the value from the form on screen, but the table won't post.
If I put the $class2 in quotes such as: INSERT INTO `#__volunteer_test` (VolunteerID, classification, title)
VALUES("1234", "$class", "MD")';
then the table posts, however the value ends up being simply $class rather than what the user filled out on the form. Do I have a syntax error here?
I'm trying to post data to another table and am having some small snags.
In the Onsubmit box, I am testing the following code:
<p>Thank you {first_name} {last_name} for registering.</p>
<?php
$class = JRequest::getVar('classification', '', 'post');
echo $class;
$db =& JFactory::getDBO();
$query = '
INSERT INTO `#__volunteer_test` (VolunteerID, classification, title)
VALUES("1234", $class, "MD")';
$db->setQuery($query);
$db->query();
The defined variable $class shows up with the value from the form on screen, but the table won't post.
If I put the $class2 in quotes such as: INSERT INTO `#__volunteer_test` (VolunteerID, classification, title)
VALUES("1234", "$class", "MD")';
then the table posts, however the value ends up being simply $class rather than what the user filled out on the form. Do I have a syntax error here?