Note that there are some explanatory texts on larger screens.

plurals
  1. POTo redirect the url
    primarykey
    data
    text
    <p>in the below code i am searching a data before searching my url will be in coursemaster_site and when i search it will be in coursemaster_site/index1 and when i close the search results the url will be in coursemaster_site /coursemaster_site but i want url to be in coursemaster_site after closing the search results.</p> <p>controller:coursemaster_site</p> <pre><code>function index1() { $data = array(); $keyword = $this-&gt;input-&gt;post('keyword'); if($keyword!=""){ $data['results'] = $this-&gt;coursemaster_model-&gt;search($keyword); } $this-&gt;load-&gt;view('coursemaster_view', $data); } </code></pre> <p>view:coursemaster_view</p> <pre><code>&lt;form action="&lt;?php echo site_url('coursemaster_site/index1');?&gt;" method = "post"&gt; &lt;br/&gt;&lt;center&gt;SEARCH:&lt;input type="text" name = "keyword" required/&gt; &lt;input type="submit" name="submit" id="opn" value = "Search" onClick="hide1('hiddendiv')" class="btn-success btn" /&gt;&lt;/center&gt; &lt;/form&gt; &lt;?php if (isset($_POST['submit'])) { // Here // Do the search here if($results){ ?&gt; &lt;div id='hideme'&gt; CLOSE&lt;a href='coursemaster_site' class='close_notification' title='Click to Close'&gt; &lt;img src="&lt;?php echo base_url('img/close.png'); ?&gt;" width="15" height="15" alt="Close" onClick="hide('hideme')"/&gt; &lt;/a&gt;&lt;div style="background:#FFFFFF; width:1000px; height: 540px; position: absolute; left: 20%; top: 35%; margin-left: -100px; margin-top: -120px" id="modal" &gt; &lt;table class="display2 table table-bordered table-striped" id='results'&gt; &lt;tr&gt; &lt;th&gt;course_code&lt;/th&gt; &lt;th&gt;course name&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt;&lt;?php foreach ($results as $row) { ?&gt; &lt;td&gt;&lt;?php echo $row-&gt;course_code;?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;course_name;?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } }else{ echo"&lt;div id='hideme'&gt; CLOSE&lt;a href='coursemaster_site' class='close_notification' title='Click to Close'&gt;"; echo "&lt;div id='modal' style='background:#FFFFFF; width:1000px; height: 525px; position: absolute; left: 20%; top: 35%; margin-left: -100px; margin-top: -110px'&gt;"; } echo"no results"; echo'&lt;/div&gt;'; echo '&lt;/div&gt;'; } // If closing ?&gt; &lt;/table&gt; &lt;/div&gt;&lt;/div&gt; &lt;script&gt; $('a.modal').bind('click', function(event) { event.preventDefault(); $('#modal').fadeIn(10); }); function hide(obj) { var el = document.getElementById(obj); el.style.display = 'none'; } function hide1(obj) { var el = document.getElementById(obj); el.style.display = 'none'; } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload