views:

137

answers:

2

When I use function create_category(), it will create a directory with this name such as images/newfolder.

Then I have a function edit_category() which checks post('name').

In a controller

function edit_category($id=0){
if ($this->input->post('name')){
...
...

I don't want to allow to change the category name. It will create another directory with a new name, images/newfolder2 etc.

In a view

$data = array('name'=>'name','id'=>'catname','size'=>25, 'value' => $category['name']);
echo form_input($data) ."</p>";

I used the following. but it does not use if ($this->input->post('name')){, so it does not work.

echo "<h2>".$category['name']."</h2>";

Do you have any good ideas to solve this problem?

--UPDATE--

I am using Codeigniter, but I don't think it is relevant in this case. I want to use if statement or some checking mechanism for this.

A: 

I do not think that there is enough information on this question to answer it, but my theory is you have the if statement to check if post('name') exists. If it does not work when you check this statement, it might give you an error. What error does it give you?

If it gives you an error like unknown member 'name' in $category, then it is because $category['name'] is not being set. Examine the code the code that sets $category['name'], and determine why it is not being set.

You should add in the error that you are receiving as well. It would help to understand what type of issue you are having.

Chad Rhyner
+1  A: 

Use form_hidden() for your name.

<input type="hidden" name="username" value="johndoe" />
codetrek