Welcome Guest, Not a member yet? Register   Sign In
[Solved] Passing parameters with URI or a form
#1

[eluser]julien.1486[/eluser]
Hi everybody !

I have some problems with the structure of my website.
Sometimes I need to display a form by using a link with a parameter (ex anchor('edit_news/'.$news->id, $news->title).

The "action" field of my form is "edit_news" too, but all parameters are transmitted by the FORM way.

And I get an error because my controller's function look like this :

function edit_news(news_id){
blablabla...
}

And when the form is submitted, there is no news_id in the URI.

There is an other way : change the "action" field to something like "edit_news_proceed" and create a new function which deal with de form validation. The first link is still like 'edit_news/'.$news->id and the edit_news function just deals with populating the form's fields with the correct values.

But there is a problem too because in my form I call the method "validation_errors();" and the library "form_validation" is not loaded by the first function (edit_news).

Do you have any solution ?

Excuse my language, I'm french
#2

[eluser]srisa[/eluser]
How about changing the action field of your form to 'edit_news/'.$news_id ?
#3

[eluser]julien.1486[/eluser]
Hum... yes... it works great !

I think it was not possible but I never try this.

Thanks a lot, srisa Smile




Theme © iAndrew 2016 - Forum software by © MyBB