Answers.Body: <p>You could append a query string on your redirect url that you can then query for in your template. I've used this to display different messages for a new post or an edited post.</p>
  
  <p><code>&lt;input type="hidden" name="redirect" value="my-photos?message=photo-added"&gt;</code></p>
  
  <pre><code>{% set message = craft.request.getQuery( 'message' ) %}
  
  {% if message|length and message == 'photo-added' %}
    &lt;p&gt;Thank's for uploading your image&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>To use fields from the saved entry you could use a plugin and watch for the <a href="https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry" rel="nofollow">entries.onSaveEntry</a> event that will fire when using the Guest Entries plugin. </p>
  
  <pre><code>craft()-&gt;on( 'entries.onSaveEntry', function( Event $event ){
    // Grab the entry from post request
    $entry = $event-&gt;params['entry'];
  
    // Add some conditionals so you only perform the redirect for the section you're posting to in the front end
  
    $name = $entry-&gt;getContent()-&gt;fieldName;
  
    // Render a template and pass the $name in
    //( not sure how to do this? )
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T16:54:54.273Z
Answers.Text: Thanks Luke. Would it be possible with the second approach to return to the same page and output a message there?
  
  I guess all I want to do is say "Thanks for getting in touch". Would rather avoid query strings but if it's the easiest way...
Answers.UserDisplayName: André Goldstein
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T16:58:52.473Z
Answers.Text: Realised I missed out the name part of your question - updated my answer
Answers.UserDisplayName: Luke Pearce
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T17:00:46.187Z
Answers.Text: Thanks so much Luke for your updated answer, I will give it a whirl!
Answers.UserDisplayName: André Goldstein
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T17:06:03.230Z
Answers.Text: Hang on, I've got the template render thing wrong
Answers.UserDisplayName: Luke Pearce
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T17:35:05.043Z
Answers.Text: You're a machine, @LukePearce.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T18:32:30.853Z
Answers.Text: Thanks again Luke, I'd be interested in seeing about how to pass in the template but have opted for the far simpler query method. I'm guessing there is no way to query the forms submission natively then with saveEntries.
Answers.UserDisplayName: André Goldstein
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-12T17:20:42.270Z
Answers.Text: @LukePearce I don't think your "Render a template and pass the $name in" will actually work, because of the redirect that will take place following it. See my answer for an alternate.
Answers.UserDisplayName: Tim Kelty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T16:44:04.803Z
Answers.LastActivityDate: 2016-05-23T18:06:33.893Z
Answers.LastEditDate: 2016-05-23T18:06:33.893Z
Answers.UserDisplayName: Luke Pearce
Answers.Body: <p>From what I can tell, Luke's answer wont actually work, because ultimately after the saveEntry event, <code>GuestEntries</code> will <code>redirectToPostedUrl</code>, which will lose any variables you have passed.</p>
  
  <p>You options are explained here: <a href="https://craftcms.stackexchange.com/questions/2210/is-it-possible-to-setroutevariables-when-redirecting-after-a-successful-form-sub">Is it possible to setRouteVariables when redirecting after a successful form submission?</a></p>
  
  <p>Example using SESSION:</p>
  
  <pre><code>// custom/CustomPlugin.php
  craft()-&gt;on('guestEntries.onSuccess', function($event) {
      $entry = $event-&gt;params['entry'];
      craft()-&gt;httpSession-&gt;add('lastEntryId', $entry-&gt;id);
  });
  
  // custom/CustomVariable.php
  public function getLastEntry()
  {
      if (craft()-&gt;httpSession-&gt;get('lastEntryId'))
      {
          $entryId = craft()-&gt;httpSession-&gt;get('lastEntryId');
          $entry   = craft()-&gt;entries-&gt;getEntryById($entryId);
  
          craft()-&gt;httpSession-&gt;destroy('lastEntryId');
      }
  
      return $entry ?? null;
  }
  
  // In your success template
  {% if lastEntry %}
      &lt;h2&gt;Review "{{ lastEntry.title }}" submission successful.&lt;/h2&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-12T14:17:01.163Z
Answers.LastActivityDate: 2016-10-12T17:18:08.027Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: Tim Kelty
Body: <p>I'm currently using the Guest Entries plugin with a front-end form to accept contact form submissions.</p>
  
  <p>I'm just wondering if it's possible to output a message on a successful form being saved?</p>
  
  <p>In an ideal world this might include the name of the submitter but failing that just a plain message informing the user that the form has been submitted.</p>
  
  <p>(Previously I've been able to access the craft.request.getPost('name') but I don't think this works when using this plugin?</p>
  
  <p>Thanks!</p>
  
Tags: <guest-entries>
Title: Is it possible to output message on successful save with Guest Entries?
ThreadText: # Is it possible to output message on successful save with Guest Entries?
  
  (Asked by: username_0 on 2016-05-23)
  
  I'm currently using the Guest Entries plugin with a front-end form to accept contact form submissions.
  
  I'm just wondering if it's possible to output a message on a successful form being saved?
  
  In an ideal world this might include the name of the submitter but failing that just a plain message informing the user that the form has been submitted.
  
  (Previously I've been able to access the craft.request.getPost('name') but I don't think this works when using this plugin?
  
  Thanks!
  
  **Tags:** guest-entries
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-05-23. Score: 2 | Accepted answer
  
  You could append a query string on your redirect url that you can then query for in your template. I've used this to display different messages for a new post or an edited post.
  
  `<input type="hidden" name="redirect" value="my-photos?message=photo-added">`
  
  ```
  {% set message = craft.request.getQuery( 'message' ) %}
  
  {% if message|length and message == 'photo-added' %}
    <p>Thank's for uploading your image</p>
  {% endif %}
  
  ```
  
  To use fields from the saved entry you could use a plugin and watch for the [entries.onSaveEntry](https://craftcms.com/docs/plugins/events-reference#entries-onSaveEntry) event that will fire when using the Guest Entries plugin.
  
  ```
  craft()->on( 'entries.onSaveEntry', function( Event $event ){
    // Grab the entry from post request
    $entry = $event->params['entry'];
  
    // Add some conditionals so you only perform the redirect for the section you're posting to in the front end
  
    $name = $entry->getContent()->fieldName;
  
    // Render a template and pass the $name in
    //( not sure how to do this? )
  });
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_1. Would it be possible with the second approach to return to the same page and output a message there?  I guess all I want to do is say "Thanks for getting in touch". Would rather avoid query strings but if it's the easiest way...  
  > **username_1**: Realised I missed out the name part of your question - updated my answer  
  > **username_0**: Thanks so much username_1 for your updated answer, I will give it a whirl!  
  > **username_1**: Hang on, I've got the template render thing wrong  
  > **username_2**: You're a machine, @username_1.  
  > **username_0**: Thanks again username_1, I'd be interested in seeing about how to pass in the template but have opted for the far simpler query method. I'm guessing there is no way to query the forms submission natively then with saveEntries.  
  > **username_3**: @username_1 I don't think your "Render a template and pass the $name in" will actually work, because of the redirect that will take place following it. See my answer for an alternate.  
  
  ---
  
  ### Answer by username_3 on 2016-10-12. Score: 1
  
  From what I can tell, username_1's answer wont actually work, because ultimately after the saveEntry event, `GuestEntries` will `redirectToPostedUrl`, which will lose any variables you have passed.
  
  You options are explained here: [Is it possible to setRouteVariables when redirecting after a successful form submission?](https://craftcms.stackexchange.com/questions/2210/is-it-possible-to-setroutevariables-when-redirecting-after-a-successful-form-sub)
  
  Example using SESSION:
  
  ```
  // custom/CustomPlugin.php
  craft()->on('guestEntries.onSuccess', function($event) {
      $entry = $event->params['entry'];
      craft()->httpSession->add('lastEntryId', $entry->id);
  });
  
  // custom/CustomVariable.php
  public function getLastEntry()
  {
      if (craft()->httpSession->get('lastEntryId'))
      {
          $entryId = craft()->httpSession->get('lastEntryId');
          $entry   = craft()->entries->getEntryById($entryId);
  
          craft()->httpSession->destroy('lastEntryId');
      }
  
      return $entry ?? null;
  }
  
  // In your success template
  {% if lastEntry %}
      <h2>Review "{{ lastEntry.title }}" submission successful.</h2>
  {% endif %}
  
  ```
  
  
  ---
  
  