1

I want to store a data from a variable to be use on different condition.

Here's my view

<form class="col-12" name="submission" method="post" action="<?php echo base_url(); ?>submission">
<div class="row">
    <div class="col-md-12 input-group">
        <select class="custom-select" id="section" name="section">
            <option selected>Section</option>
            <?php foreach ($get_section->result() as $row) { ?>
                <option value="<?php echo $row->section; ?>"><?php echo strtoupper($row->section); ?></option>
            <?php } ?>
        </select>
    </div>
</div>
<form>

So I wanted to store the value that I selected in an PHP varible

I tried this method but im getting

$var = $_POST['section'];

But im getting this error message

Undefined array key "section"
awiz
  • 11
  • 3

0 Answers0