Welcome Guest, Not a member yet? Register   Sign In
Save image path to database / edit function not editing entry but inserting new one
#11

[eluser]ede196620[/eluser]
Code:
protected $_primary_filter = 'intval';
$filter = $this->_primary_filter;

this is where the filter is

here is the input form:
Code:
<div class="modal-header">  
    <h3>&lt;?php echo empty($product->product_id) ? 'Add a new item' : 'Edit Item ' . $product->product_name; ?&gt;</h3>
</div>
<div class="modal-body">
    &lt;?php echo validation_errors(); ?&gt;
    &lt;?php echo form_open_multipart('site_user/product_c/edit'); ?&gt;
    &lt;?php echo form_hidden('id', $this->session->userdata('id')); ?&gt;
    <table class="table">  
        <tr>
            <td>Product Name</td>
            <td>  &lt;?php
                echo form_input('product_name', set_value('product_name', $product->product_name));
                
                ?&gt;
    
            </td>
        </tr>
        <tr>
            <td>Item Description:</td>
            <td>&lt;?php
                echo form_textarea('body', set_value('body', $product->body));
                ?&gt;</td>
        </tr>
      <tr>
            <td>Category</td>
            <td>            
                    &lt;?php
                    foreach ($category as $categorys) {
                       echo $categorys->category_name .form_radio('category_id', set_value('category', $categorys->category_id)).'</br>';
                    }

                    ?&gt;
            </td>
        </tr>
        <tr>
            <td>Sell/Trade</td>
            <td>
                &lt;?php
                $data_trade = array(
                    'name' => 'sell_or_trade',
                    'id' => 'trade',
                    'value' => 'trade',
                    'checked' => TRUE,
                    'style' => 'margin:10px',
                );
                 $data_sell = array(
                    'name' => 'sell_or_trade',
                    'id' => 'sell',
                    'value' => 'sell',
                    'style' => 'margin:10px',
                );
                ?&gt;
                &lt;?php echo 'Sell' . form_radio($data_sell); ?&gt;
                &lt;?php echo 'Trade' . form_radio($data_trade); ?&gt;
&lt;!--                &lt;input type="radio" name="sell_or_trade" id="sell" value="sell"&gt;
                &lt;input type="radio" name="sell_or_trade" id="trade" value="trade"&gt;--&gt;
            </td>
        </tr>
        <tr>
            <td><div class="text">Starting Price:</div></td>
            <td>
                <div class="text">      
&lt;!--                    &lt;input type="text" name="price" id="price" maxlength="30"&gt; --&gt;
                    &lt;?php
                    $data = array(
                        'name' => 'price',
                        'id' => '',
                        'value' => $product->price,
                        'maxlength' => '100',
                        'size' => '50',
                        'style' => 'width:50%',
                    );
                    echo form_input($data);
                    ?&gt;
                </div>  
            </td>      
        </tr>
        <tr>
            <td>Upload Photo:</td>
            <td>&lt;input type="file" name="img_path"  size="20" /&gt;&lt;/td>
        </tr>
        <tr>
            <td>&lt;?php echo form_submit('submit', 'Save', 'class="btn btn-primary"'); ?&gt;</td>
        </tr>
    </table>
    &lt;?php echo form_close(); ?&gt;
</div>



Messages In This Thread
Save image path to database / edit function not editing entry but inserting new one - by El Forum - 05-19-2014, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB