Welcome Guest, Not a member yet? Register   Sign In
Validation callback that changes value doesn't work on arrays?
#8

[eluser]Beginers[/eluser]
ILL SHARE MY KNOWLEDGE TO YOU ALL. I ALSO USE ARRAY IN MY WEBSITE HERE IT IS CONSIDERING I HAVE A MULTIPLE ARRAYS OF NAME:

VIEW
Code:
<?php echo form_open('controllername/functioname');?>
<input type="text" name="name[0]" value="Name 0"/>
<input type="text" name="name[1]" value="Name 1"/>
<input type="text" name="name[2]" value="Name 2"/>
<input type="text" name="name[3]" value="Name 3"/>
</form>

CONTROLLER
Code:
$countinput = count($this->input->post());
//for loop alternatives
for($i=0;$i<=($countinput-1);$i++):
$this->form_validation->set_rules('name['.$i.']','Names','required|trim|');
endfor;

I hope this help. im just a beginers hehe. if you have any questions fill free to PM me


Messages In This Thread
Validation callback that changes value doesn't work on arrays? - by El Forum - 09-10-2012, 02:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB