help with looping query XD |
[eluser]KrizzAngel[/eluser]
ok i got this on my model: Quote:$segment=$this->input->post('seg'); then on my view: Quote:<? echo form_open('admin/add'); ?> any suggestion for looping query?? i really dont know how em i gonna use or retrieve the < name tag > of the looped text/textarea
[eluser]theprodigy[/eluser]
Quote:for($z=1;$z<=$segment;$z++){ try Code: for($z=1;$z<=$segment;$z++){
[eluser]KrizzAngel[/eluser]
but is it ok to assign a variable (ex. $content) plus the variable on the loop which is $z so it would be $content$z?
[eluser]theprodigy[/eluser]
You can (I believe). But you may have better luck using array field names Instead of: Quote:<?try Quote:<?
[eluser]KrizzAngel[/eluser]
parse error on line 16 where my first post "$lessNum$z=$this->input->post('lessonNum' . $z);" resides. :/ dunno how to catch the looped name of the form from my view huhu
[eluser]KrizzAngel[/eluser]
oh bout ur post above the i didnt put any code on that "file" type yet so i leave it blank/no name. why []?? on my model how can i catch that??
[eluser]theprodigy[/eluser]
To be honest, I'm not really sure how you would catch it, as I personally have never used it that way, but I believe (by reading through the form validation section in the user guide), you would catch it as: Code: $this->input->post('lessontitle[]'); I only say that because in the form validation section, it says that in order to run validation on the field you have to specify it that way. It would only be logical that you would have to catch it that way. After successfully catching it, I believe you would have an array for a variable, but I would run a print_r on it first. Code: $title = $this->input->post('lessontitle[]');
[eluser]theprodigy[/eluser]
doing it that way, you won't have to worry about trying to create variable variables. But in case you still want to do it that way, you may want to take a look at: http://php.net/manual/en/language.variab...riable.php
[eluser]KrizzAngel[/eluser]
after using that [].. i still recieving parse error.. :/ |
Welcome Guest, Not a member yet? Register Sign In |