Click here to Skip to main content
15,877,565 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I have a CodeIgniter project it works fine when I use it on localhost (XAMPP) but when I run it online and submit the form below it gives me You don't have permission to access this resource.

Form is:

<form method="post" action="<?=site_url('quizsubmitted') ?>">
             <div class="card-body">
               <table id="example1" class="table table-bordered table-striped">
                           <th colspan="4" style="text-align: right;"><h4 id="time"><?=$qrow['duration'];?></h4></th>
                           <input type="hidden" name="quizid" value="<?=$qrow['quizid']; ?>">
                       <input type="hidden" name="studentid" value="<?=$studentid; ?>">
               $i = 1;
                foreach($rows as $row) { ?>
                   <td colspan="4" ><label class="text-dark"> <?=$i; ?>. <?=$row['question'] ?></label></td>
                   <!-- <input type="hidden" name="qid[]" value="< ?=$row['qid']; ?>"> -->
                   <input type="hidden" name="question[<?=$i; ?>]" value="<?=$row['question'] ?>">
                       <input type="radio" value="<?=$row['answer1'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer1[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer1'] ?></label>
                       <input type="radio" value="<?=$row['answer2'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer2[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer2'] ?></label>
                       <input type="radio" value="<?=$row['answer3'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer3[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer3'] ?></label>
                       <input type="radio" value="<?=$row['answer4'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer4[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer4'] ?></label>
                       <input type="hidden" name="correct[<?=$i; ?>]" value="<?=$row['correct'] ?>">
               <?php $i++; } ?>
             <div class="card-footer">
                 <button type="submit" class="btn btn-primary">Submit</button>


public string $baseURL = '';

   public array $allowedHostnames = [];

   public string $indexPage = '';

   public string $uriProtocol = 'REQUEST_URI';

Please help.

What I have tried:

htaccess is like below:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

1 solution

I think it may be because some directories in your server, apache or www user lack permissions.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900