Forums

Getting the article title and including in form.

designsedge 27 Oct, 2016
Hey everyone -
Wanted to take a moment and share a fix that Max was kind enough to help me with.
Situation: I needed to include the article's title into my form. The form is called via the plugin, and I wanted to know which article the form was coming from.
After some research, found this code to pull in the article's title and pass it through the form data. Hope this helps someone.
<?php 
$input = JFactory::getApplication()->input;
$id = $input->getInt('id'); //get the article ID
$article = JTable::getInstance('content');
$article->load($id);
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $article->get('title') ?>' />
GreyHead 27 Oct, 2016
Hi designsedge,

Great - there are some other possibilities in this FAQ too.

Bob
This topic is locked and no more replies can be posted.