CodeIgniter Forums
form_open() Error MSG: Trying to get property of non-object - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: form_open() Error MSG: Trying to get property of non-object (/showthread.php?tid=72642)



form_open() Error MSG: Trying to get property of non-object - swingman - 01-17-2019

I am using this form post with jQuery Datatables
I am getting a error on the page when it loads indicating "Message: Trying to get property of non-object"

<?php echo form_open('myController/ajaxSaveProduct/' . $this->encryption->encrypt($productData->id), array('method' => 'POST', 'role' => 'form', 'accept-charset' => 'utf-8', 'enctype' => "multipart/form-data", 'id' => 'productForm'));

<table id="productTable">
<thead>
<tr>
<th>Product</th>
<th>Description</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tire</td><td>Large Black Tire</td><td>Desc 1435</td>
</tr>
</tbody>
</table>
<button id="saveProduct">Save</button>


<select style="width:100%;" name="value[1]" data-bind="value: product_1" id="product_1" class="form-control" onchange="valueChange()">
<option value="">Choose Yes / No</option><option value="yes">Yes</option><option value="no">No</option></select></td></tr><tr id="62" data-attribute-attributeid="62" data-attribute-controltypeid="1" data-attribute-description="Desc 1428" data-attribute-title="Test MA 1428" role="row" class="even"><td>Test MA 1428</td><td>Desc 1428</td><td><input style="width:100%;" type="text" name="attributeValues[62]" data-bind="value: attribute_62" id="attribute_62" value="xxxx-0001" class="form-control" onchange="ckValueChange()"></td></tr><tr id="2" data-attribute-attributeid="2" data-attribute-controltypeid="9" data-attribute-description="Locations receive small red box" data-attribute-title="SMALL Red Box Carton" role="row" class="odd"><td>SMALL Red Box Carton</td><td>Locations receive small red box</td>

<td><select name="productValue[1]" data-bind="value: product_1" id="product_1" class="form-control" onchange="changeValue()"><option value="">Choose Yes / No</option><option value="yes">Yes</option><option value="no">No</option></select></td></tr>

</table>


RE: form_open() Error MSG: Trying to get property of non-object - php_rocs - 01-17-2019

@swingman,

What have you done to trouble shoot the issue? Have you removed any items from the forms to see if it works? Do you have any ideas what is causing the error?


RE: form_open() Error MSG: Trying to get property of non-object - InsiteFX - 01-17-2019

form_open() should be form_open_multipart()

Then remove the arry field multipart/form-data

SEE:

CodeIgniter User's Guide - form_open_multipart