dropdown list clears after press submit button |
I am new to the codeigniter. i m doing one application there are two dropdown list and one sumbit button. based on dropdown value list's are displayed. every think is ok. i got the value to the controller .post is working well.
but the dropdown list clears after submit button presses. why?
In the part you generate options, you also need to set the selected option.
You can do this by checking the returned post variable with select tag name attribute with looped through city codes you use to set option return values: PHP Code: <select class="form-control required" id="sel_bran" name="branch"> You can also use CodeIgniter built in form helper to generate HTML for select dropdowns.
no changes.
my form look like <?php $this->load->helper("form"); ?> <?php echo form_open('user/addtest'); ?> <?php $attributes = array('class' => 'form-inline reset-margin', 'id' => 'myform'); ?> I st drop down list II nd dropdown list <?php $data_submit = array('name' => 'submit', 'value' => 'Go'); ?> <?php echo form_submit($data_submit); ?> <?php echo form_close(); ?> once this form close i can able to post ,my data pass to the controller name called "add_attend" . <?php echo form_open('User/add_attend'); ?> any suggestion
The problem would still be with how you generate the dropdowns, not with how you do the rest.
Also, you can use the helpful php tags to format your code nicer and make it easier to read on the forum (06-25-2018, 01:30 AM)kvanaraj Wrote: i attached my complete code Looks like you have two forms in that file? One starts on line 28 and ends on line 72, and one with no obvious start point but it's closed on line 129. In HTML you can only submit one form element at the time, and only elements inside that <form> will be submitted. You can't have form elements inside another form element, and form has to start and close on the same level, so you can't start form inside a table cell for example then close it on different table cell, you have to move it out to wrap the whole table. As a next step, if I was you, I'd debug the POST I get between pages and first make sure all the info I expect to be sent back from the browser actually is.
screen shot of my page is attached. kindly help me. what wrong with my coding and also my screenshot of output
|
Welcome Guest, Not a member yet? Register Sign In |