Retrieval of variables

Hi, I’m new to Sparkle and have the following question:
If I create a text entry on page 1 using the form variable “Name”, can I somehow retrieve it on page 2 in a text field?

E.g. on page 1 the form variable Name= John was entered via text input.

On page 2 I want a text field with the content "Good evening "+variable Name. Is there any way to do this?

Many thanks for your help

Hi @pitchbend69, Sparkle’s forms are currently focused on sending a contact form email. There also is an “Advanced form submission” mode that’s more “raw” and coding oriented.

We do need to add something with the user friendliness of the contact form but flexibility of the advanced form submission, but it’s not currently available exactly like that.

What is possible with a little coding is to use some PHP code in an embed element, to surface the variables sent to the page. Coding discussion is out of scope, but if you know how, you can do it.

Thanks @duncan for your answer. But where can i buy the developer tools upgrade?

I have updated Sparkle to the latest Pro 5 version but I can’t find the Developer Tools add-on. Where can I buy it? I am always redirected to the website where the add-on is explained but I can’t buy it.

What do you see in the popup window when you check your license? The last point is Developer Tools.

It’s not actually necessary to buy the Developer Tools to enter a little code in an embed window.

Certainly! You can accomplish this using PHP by passing the value of the “Name” form variable from page 1 to page 2 through a URL parameter or a session variable. Here’s an example of how you can achieve this:

Page 1:

<form action="page2.php" method="POST">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name" />
  <button type="submit">Submit</button>

Page 2 (page2.php):

session_start(); // Start the session

// Check if the form data has been submitted
  // Retrieve the "Name" value from the form
  $name = $_POST["name"];

  // Store the "Name" value in a session variable
  $_SESSION["name"] = $name;

  // Redirect to page 2
  header("Location: page2.php");

// Retrieve the "Name" value from the session
$name = $_SESSION["name"];

// Display the greeting with the "Name" value
$greeting = "Good evening " . $name;

<!-- Display the greeting in a text field -->
<input type="text" value="<?php echo $greeting; ?>" />

In this example, on page 1, the form data is submitted to page2.php. The value of the “Name” input is stored in the $_SESSION["name"] variable. On page 2, the stored value is retrieved from the session, and the greeting is generated by concatenating "Good evening " with the name. Finally, the greeting is displayed in a text field.

Make sure to save the page 2 file with the “.php” extension and ensure that your server supports PHP for the code to work correctly.

Hello :wave:t2:

If the page where you want to display the user’s name is password protected, you can use the “Smart Field” feature in a text field. This feature allows you to insert information about a registered user (such as name, username, email, etc.) directly into a text field.

If you don’t want to password protect your page, you can indeed accomplish this easily with a few lines of code and by using Sparkle’s form fields and buttons. However, I advise against using the code kindly provided by lpbeats as it contains an error. If you need help with the code, feel free to send me a private message. :blush:

While it’s great to offer alternative solutions and advice, Allan, it’s also crucial to be specific when pointing out purported errors. Saying that the code “contains an error” without elaborating can create unnecessary confusion and discredit the work without basis.

The code at is live and functioning, providing a working example of the task at hand. If you could detail the specific issues you see in the code, it would be more constructive for everyone involved.

Being precise in constructive criticism not only validates your point but also helps the original author and anyone else who might be following the discussion. After all, the aim here is collaborative growth, isn’t it? :blush: