Forums

[Solved] Get item id into a form and database

yaK2manD 24 Apr, 2011
Hello ;

Firstly, thank you for the component.

Secondly : I've a problem with my form.
I would like to have an hiddenfield (that is done) with the current item_id (not done).
My form will be integrated in content and data will be saved depending on item_id.

I don't know how to do that.
With user, a simple GetUser() does the trick.


Another problem : throught Chronoforms' link "frontend view"; data are saved. But when I run my form into an article, data are not saved. What happened ?

Could you help me please.

Thank you.
GreyHead 24 Apr, 2011
Hi yaK2manD ,

Where does the current item_id come from? Do you mean the current menu ItemID?

Bob
yaK2manD 24 Apr, 2011
Nop;
it comes from the article.
I insert a form in an article and I would like to have an hidden field with the article's id
yaK2manD 25 Apr, 2011
I've made a leap forward :
Now I can save into the database.
I don't know why, but when I used my own table, it did not work. Now when I use a chronoforms table made, it works fine.


Now, the main problem is to get the current article id.
GreyHead 25 Apr, 2011
Hi yaK2manD,

The table needs a primary key set for the DB Connection to work - maybe your table didn't have one.

Try this to get the article ID
<?php
$id = JRequest::getInt('id', '', 'get');
?>


Bob
yaK2manD 25 Apr, 2011
YES IT WORKS !!!!!!!!!!!! 😀

Thank you very much !!!

I will do with the chronoforms' made table. It's just perfect.

One more time, thank you very much.
3 days I was working on it.
This topic is locked and no more replies can be posted.