-4

I would like to understand how to create Articles using PHP. As today I use Fabrik to collect info using form, but i need to create in authomatic way a Joomla Article based on those data.

I'm looking for a solution (if is possible) based on PHP that will be executed when user submit the form.

TylerH
  • 20,799
  • 66
  • 75
  • 101
paolo_joomla
  • 9
  • 1
  • 2
  • thanks for your answer. But probably I was not clear. Now I have a form that store data in a table (myTable). This table contains 2 field : myTitle, myText. I would like that when user submit the form, an Joomla Article is authomatic created. I mean that after user submit the form, browsing xx_content table I will found a row containing Title=myTitle and Fulltext =myText. I hope that now is more clear. – paolo_joomla May 02 '12 at 09:53

2 Answers2

0

To run PHP code or a pre-written script following the submission of a Fabrik form, use the PHP Form Plugin. Scripts that run via the PHP Form plugin are within the scope of the Joomla application, so you could definitely automate the creation of an article (by way of the com_content component).

If you have questions about using the plugin, your best bet would be asking on the Fabrik Forums

transient closure
  • 2,511
  • 2
  • 12
  • 6
-3

You would, preferably, save the article in a database (MySQL, maybe) then you would using the form (using METHOD="POST") send the results and extract them (using $_POST['* name of input']) and then save that variable into the MySQL database.

<form action="?article=submit" method="POST">
<input type="text" name="title"/>
<input type="submit"/>
</form>

<?php
if($_GET['article'] == "submit"){
if(!empty($_POST['title'])){
mysql_query("INSERT INTO article (title)VALUES ('".$_POST['title']."')")or die(mysql_error());
}

}
?>
mikkeljuhl
  • 400
  • 1
  • 5
  • 13
  • 1
    ouch @ sql injection vulnerability! Just a matter of time before someone puts "foo'); drop table articles;" in there and giggles at your loss. – Kris May 02 '12 at 09:49
  • 1
    Isn't that presumed knowledge? Personally I always have a function "replacing" mysql_query that runs mysql_real_escape_string and all the others. – mikkeljuhl Jun 09 '12 at 12:47