Welcome Guest, Not a member yet? Register   Sign In
set_value() is working but set_select() not working
#13

(This post was last modified: 09-08-2023, 02:02 AM by sknair143.)

(09-08-2023, 12:34 AM)sammyskills Wrote: Put this in your controller, and echo it in your view:

PHP Code:
$oldSelect $this->request->getOldInput('doc_type_id'); 

This also returning NULL

This also returning NUL

Code:
$oldSelect = $this->request->getOldInput('no');

I figure it out something, When i move the select box to second position it works but now the first inputbox (Doc no) not working.

Code:
<?php echo form_open_multipart('') ?>


        <div class="row mb-3">
            <label class="col-sm-2 col-form-label" for="basic-default-company">Doc No</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" value="<?= set_value('no') ?>" name="no"
                    id="basic-default-company" placeholder="1995/23234/3434DF">
                <span class="error">
                    <?= session('errors.no'); ?>
                </span>
            </div>

        </div>
        <div class="row mb-3">
            <label class="col-sm-2 col-form-label" for="basic-default-name">Document Type</label>
            <div class="col-sm-10">
                <select name="doc_type_id" id="doc_type_id" class="form-select">
                    <option value="">Select</option>

                    <?php foreach ($doc_types as $doc): ?>
                        <option value="<?= $doc['id']; ?>" <?= set_select('doc_type_id', $doc['id']) ?>> <?= $doc['name']; ?>
                        </option>
                    <?php endforeach; ?>
                </select>
                <span class="error">
                    <?= session('errors.doc_type_id'); ?>
                </span>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2 col-form-label" for="basic-default-company">Expiry Date</label>
            <div class="col-sm-10">
                <input class="form-control" type="date" value="<?= set_value('expiry_date') ?>" name="expiry_date"
                    value="" id="html5-date-input">
                <span class="error">
                    <?= session('errors.expiry_date'); ?>
                </span>
            </div>

        </div>

        <div class="row mb-3">
            <label class="col-sm-2 col-form-label" for="basic-default-company">Upload Doc <br /><small>(Allowed JPG, GIF
                    or
                    PNG)</small></label>
            <div class="col-sm-10">
                <input class="form-control" type="file" name="doc_file" id="formFile">
                <span class="error">
                    <?= session('errors.doc_file') ?>

                </span>
            </div>


        </div>

        <div class="row justify-content-end">
            <div class="col-sm-10">
                <button type="submit" class="btn btn-primary">Save</button>
            </div>
        </div>
        </form>


I think the issue with SESSION
Reply


Messages In This Thread
RE: set_value() is working but set_select() not working - by sknair143 - 09-08-2023, 01:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB