Welcome Guest, Not a member yet? Register   Sign In
$_POST values with a dynamic list
#1

[eluser]tim1965[/eluser]
Hi

Im either going to kick myself at the answer to this or maybe it really is as complicated as it seems.
I have a multi image upload view with two forms on it. The first form handles the upload and the second displays the image and image description. I also give the user the option to edit or delete the image. It is the edit part that i am struggling with. I create the second part of the form in a foreach loop
<p>&lt;?php foreach($picture as $r): ?&gt;
<img src="&lt;?php echo base_url().$path.$r['imagename']; ?&gt;" width="100" height="100" alt="&lt;?php echo $r['photo_desc']; ?&gt;" title="&lt;?php echo $r['photo_desc']; ?&gt;" /><br>
<p>&lt;?php echo $r['photo_desc']; ?&gt;</p>&lt;?php echo anchor('property_registration/multifileupload_v1/delete_photo/'.$r['imagename'],'Delete Photo'); ?&gt;
<div class="add_desc">Edit Description</div><div class="photodesc">&lt;?php echo form_input($photodesc); ?&gt;&lt;input name="image_name" type="hidden" value="&lt;?PHP echo $r['imagename']; ?&gt;" /&gt;&lt;input type="submit" name="update_photo_desc" id="update_photo_desc" value="Update Description" /></div>&lt;?php echo form_error('photodesc'); ?&gt;
&lt;?php endforeach; ?&gt;</p>
To allow users to edit the comment i have added a text field input
Quote:
<div class="add_desc">Edit Description</div><div class="photodesc">&lt;?php echo form_input($photodesc); ?&gt;
Quote:
created by an array in my controller.
Quote:
$data['photodesc'] = array(
'name' => 'photodesc[]',
'id' => 'photodesc[]',
'maxlength' => '50',
'size' => '50',
'style' => 'width:50%'
);
Quote:
I then hide this using javascript, and show it when they click an icon.

So to my problem. Its very simple. The $_POST array values are being overwritten. I onñly want the description field that has been amended and the associated image name. I have tried everything from mergin arrays to stripping out null values. But i cannot seem to crack it. The other option i could go down is to open a new view and get the user to enter the data in that and then post it. So if my approach is hard work then please let me know. Apoilogies as this is not a pure Codeigniter issue.
Thanks


Messages In This Thread
$_POST values with a dynamic list - by El Forum - 08-12-2009, 03:26 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 04:31 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 04:39 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 05:06 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 05:15 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 05:36 AM
$_POST values with a dynamic list - by El Forum - 08-12-2009, 06:05 AM
$_POST values with a dynamic list - by El Forum - 08-13-2009, 05:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB