Hi,
I've used the chronoform component for several Forms on my website. It really helps me making forms quite fast! But now I have a problem I couldn't solve.
I've made a form to store some given in article in a database which is not the joomla-database. The code is below. For some strange reason, when I submit a "news"-article everything works fine. But when I try to submit an "upcoming"- or "link"-article I get some errors from MySql that my syntax isn't correct. Okay then, I will check the syntax of my query by simply echoing it. But the query I've made for a "upcoming"- or "link"-article isn't the query I've made! Instead of
Thanks in advance!
Code (Because I assume that are my variables are properly initialized, I only post the processing-part and not the layout of my form)(The code is placed at the "On Submit code - after sending email"-part of the form) :
I've used the chronoform component for several Forms on my website. It really helps me making forms quite fast! But now I have a problem I couldn't solve.
I've made a form to store some given in article in a database which is not the joomla-database. The code is below. For some strange reason, when I submit a "news"-article everything works fine. But when I try to submit an "upcoming"- or "link"-article I get some errors from MySql that my syntax isn't correct. Okay then, I will check the syntax of my query by simply echoing it. But the query I've made for a "upcoming"- or "link"-article isn't the query I've made! Instead of
INSERT INTO events_table (`date`, `data`, `image`) VALUES ('$date', '$data', '$image');
I get SELECT * FROM #__chrono_contact_plugins WHERE form_id='12' AND event='ONSUBMIT' AND name="
. What is going wrong here?Thanks in advance!
Code (Because I assume that are my variables are properly initialized, I only post the processing-part and not the layout of my form)(The code is placed at the "On Submit code - after sending email"-part of the form) :
<?php
$category = $_POST['select_4'];
$title = $_POST['text_11'];
$date = $_POST['text_8'];
$image = $_POST['text_10'];
$data = $_POST['text_9'];
switch ($category)
{
case "news":
$query = "INSERT INTO news_table (`date`, `data`, `image`, `title`) VALUES ('$date', '$data', '$image', '$title');";
break;
case "upcoming":
$query = "INSERT INTO events_table (`date`, `data`, `image`) VALUES ('$date', '$data', '$image');";
break;
case "link":
$query = "INSERT INTO link_table (`title`, `link`) VALUES ('$title', '$data');";
break;
}
echo $query;
$selectResult = mysql_select_db("X" ) or die ('Error switching db'.mysql_error());
$result= mysql_query( $query ) or die ('Error Inserting'.mysql_error());
$selectResult = mysql_select_db("JOOMLA_DATABASE" ) or die ('Error switching db back'.mysql_error());
echo "Article submitted!";
?>