Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter reload page with id in url
    primarykey
    data
    text
    <p>On this site that I’m coding I have a page that is accessible through the following urls:</p> <p><a href="http://site.com/campaigns/view/" rel="nofollow">http://site.com/campaigns/view/</a></p> <p>which displays a default view of all campaigns and lets say</p> <p><a href="http://site.com/campaigns/view/8" rel="nofollow">http://site.com/campaigns/view/8</a> </p> <p>which displays details for campaign 8</p> <p>On this page I have a form from which you can add subscribers to the specific campaign. My controller logic goes something like this:</p> <pre><code>$campaign_id = $this -&gt; uri -&gt; segment(3); $this -&gt; campaign_model -&gt; get_campaign_details(3); // Form was submitted if ($this -&gt; input -&gt; post()) { //code to check inputs and save subscriber } else { // Display page with campaign details } </code></pre> <p>Now my problem is, in the else branch, how would I go about displaying the page with the campaign details. I’ve tried <code>redirect("campaigns/view/8")</code> which creates a redirect loop and also</p> <pre><code>$this -&gt; load -&gt; view("campaigns/view/".$campaign_id) </code></pre> <p>which of course tries to load a view 8.php that doesn’t exist. So how would I go about implementing the functionality for something like this?</p> <p>Thanks in advance!</p> <p>Jim</p> <p>EDIT:</p> <p>If there isn't a post submit what I would like to see is the details, which includes among others the list of subscribers, for campaign number 8, 9 etc.</p> <p>If there is a post submit I would like to see the details page again which of course this time would include the newly added subscriber.</p> <p>Submit again -> add subscriber -> details view again and so on.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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