Variation on Send Email workflow?

I tried to install this into my “Insert into Database from Form” page according to the following:
github tutorial Send Email Form form

When I was through the form would not carry out the insert form post values to the database table it had worked with before.

This topic is not to immediately jump into diagnosing the code but to ask some questions about this Method –

  1. Can the same form that was originally set up to simply insert the post values to a table
    THEN be modified – new actions steps following the Post steps --to ALSO Send Email with additional Email Formcomponents?

(In PHP, of course, yes)

But is a different approach more foolproof working with Wappler components & action steps?

  1. For instance instead of loading my working Form page with more components in the expanding tree of actions & more code applied from the App Structure components –

I’d like my form page just before its Connection Success code redirects the Browser action to the next page –
to pass Send Email actions over to a Dedicated Send Email php page
All Send Email actions reside on this separate page – keeping my original form page working & lean.

Send Email is a separate page whose code & connections & components do the heavy lifting – either taking current form posted values or
initiating a MYSQL loop to retrieve the new record from the table & send the query values, not the posted values of the form, to the dedicated Send Email page.

I hope this is clear. It is common in PHP.

As far as the questions are concerned and also questions asked in your previous posts, I get the impression that you are still hugging onto PHP. Initially, I did the same. In other words, I have been there and done that.

Take it from this old codger and forget PHP and the ‘old’ way. Concentrate on what Wappler has to offer. The answer to those questions is: yes you can do all of that in Wappler, even redirect to a page before the Action Steps have been completed. Just use the serverside Redirect

1 Like

Thank you “Old Codger”!

I am still confused about the best approach to take about setting values I can refer to again on other pages – especially in dropping dynamic values into the Query Conditions.

For a Login Page when I want to use the Key Id in the Login for later actions such as setting up a dynamic query for a User Details Table (step-by-step OR Generators Bootstrap options)

  1. What I mean is I see one tutorial on setting SESSIONS from the login inputs

  2. Another on using the Security Provider to establish dynamic values that can be used on another page with the Text Binding operation

  3. Then another tutorial showing Using the Form Input to Import Form values from the referred page – which I take it can be used for the Current Login page.

  4. Another on the SET SESSION action

I’m trying to get just one tried-and-true method for Assign or Set Login key id values that are available as dynamic variables for Queries on other pages

Best of Practice for you, Ben?

Sounds like you are trying to recreate what Wappler is already doing.

Wappler is not geared toward the 20 year PHP veteran but more the person with little to no knowledge, so it assumes this from the start.
On your form page, it is already lean, the heavy lifting files are included inside the Wappler core files so there is no need for you to try recreate that sort of functionality.

If it were me, this is the best procedure in my mind

For the Login steps do not use the custom SESSIONS you are trying to use because you are again trying to be smarter than what the application intended and they have already done this all for you, and it is fully accessible on any and all pages as the security provider. In the simplest tutorial i can muster, here is how it works.

You already have a database, with some type of users table, each user has an auto incremented ID, a username, and a password.
In your server connect actions you create a login action with your security provider step and a login step, after this runs Wappler holds only the ID of this user, which you can refer to over the entire application.
You have a Login page, this checks against the username and password in your database and if correct stores the ID which it uses over every page then on to reference back against.

Once successful you redirect the user to the first backend page, it uses a security provider enforcer to make sure the user looking at the page is logged in.
You have a form on this page which writes to the database on submit, and more than likely the data submitted with this form is owned by the user, so its their data, therefore there is no need to try store all the inputs locally because its easy to get from the database if the logged in user ID is stored with the data they just input.

Unfortunately, I was in the same boat as you when I first started, so hung up on PHP and the logic behind it that I was missing out on the true power to a large degree.

I hope I am making sense.


Thanks again, PRO!

Just one thing – I keep seeing in all the docs & tutorials –

“if correct stores the ID which it uses over every page then on to reference back against.”

THIS is what I never find explained. It is a dynamic variable,

But when it is PRINTED what does it look like?

The ACTUAL visible display of “ID of this user”

Reveal the mystery, at last – What are the Values when the ID is applied?

I’ve been just routinely accepting the row key id as “Identity” but it is actually the USERNAME that is to be the “Identity” if this is what Wappler means.

I have 2 dynamic variables here

the actual Value I always want is USERNAME
which can be numeric, varchar text & numbers
or encrypted

I am always, from the beginning of all my questions over the eons, stipulating

$_POST.username in php terms

I am actually not sure, to be completely honest if its an array or a direct value, but it has not really mattered to me because I use the ID from the security provider right away on my page to query the database and get the rest of the required fields.

So from the Login page, user clicks login, Security provider stores this ID
Next page, first Server Action is a database query that gets the users username field in your case and is filtered by the security provider ID, so regardless of if the security provider already has it or not, which I do not think it does, if you are then as step 1 fetching the users table where user id = security provider ID, then only that one username will be returned.
And then you can use that on each step as you progress.

I usually want to run another query, which I see from one tutorial can go on the login page to now get More User Details – business name, address, city, etc.

So this whole ID thing has been important.

But now that I look at the Security Provider again it seems that IDENTITY is my responsibility to make sure that it looks like this –

so that IDENTITY is that Username (which is unique)

I suppose you could do that, I wouldnt say it’s the standard practise, so I could not vouch for if its going to cause any issue later on.

Personally i think rather just use it as intended.
Identity: akm_id
Username: username
Password: password

Next Server Action
Database query, username where security provider identity = akm_id

At least this way you when you need more assistance along the way, you are not doing it different to anyone else.

But I suppose its also dependent on how your database is setup, if your products table or whatever is storing the username of the user and not the ID then maybe its a better way to go.

Normally I use ID vs Username for scalability later on, as an example I just had this hacker / script kiddie on my cPanel, I changed password, and the next day he was back and having fun again, I needed to change the username and password to get rid of him, so if you ever have a scenario where a persons username needs to alter its better if everything is referencing by the ID which does not need to change ever.

I don’t understand this –

SELECT username, street, city where akm_id= {{security provider identity}}

is this what you mean as another conditional query after the log-in is successful?

Besides, the akm_id is just the auto_increment value – yes, a key id for today.

But what if the table is regenerated with a new akm_id for each record?

the USERNAME is the Unique Value that will stay the same no matter how the table is jiggered with. The akm_id is really independent of the records themselves – it just placeholds for counting & yes, retrieving a record if you know its akm_id

But the most important value is the Unique ID for that business.

And if I export records from this table the akm_id is extraneous, irrelevant & not useful if I wan to recreate the table after records have been pruned, for instance.

The auto-generate id field certainly doesn’t need that akm_id – allowing also to rename that key id to correspond to the actual table name if it is changed.

Yeah, thats what i mean.

Im going to make a quick video, maybe that will clarify a few things, give me a few moments, its not going to be an official video, just a random one.


The way I do this is to create Server Actions that are secured. In other words, no one BUT the logged-in user can retrieve the information. On each page that this data is required, I place the data source (Server Connect) and the data is available to the logged in user. This can be extended for personal information or for information specific to his part of the application.

To see what I mean, go to

Edit: In the same manner, server side data can be secured for a group of users as opposed to another group of users, all on the server.


Do you or hyperbytes already possibly have a video on this step Ben

1 Like

I do not think that one (video) exits. But here is an example where I have filtered the orders so that the data can only be seen by the logged in user. I have done the same for the logged in user details.

Edit: I should have written that the data relevant to the customer can only be seen by the customer. Same as with the customer details. All other data remains hidden behind a secure wall. How I love Wappler.

1 Like

@NewMedia, it took some time to get around to it, but here it is

Incredible! I’m about to settle in to your Video, Paul

But before I go to that I must ask an important question regarding the task I have today – Sunday.

I have a Login page with Security Provider that is working.

Here’s the Order –

Logn.php – security protected – On Success redirects to –

Events.php – protected

This is the output of a query to the “events table”
looping through picking up fields for each location record

Clicking on one of the Links (hotel name associated with city and date)
PASSES results of query into the URL of the next page that it calls for

as in – https://mywebsite/hotel/events_registration.php?event=2&pharmacyid=100008&eventhotel=Crowne%20Plaza%20Hamburg%20-%20City%20Alster&eventdate=Crowne%20Plaza%20Hamburg%20-%20City%20Alster&eventdate=17-03-2020&eventcity=Hamburg

The actual Registration Form now shows up with data filled in already from the URL

After this is submitted there’s a final “Thank you , you may logout or Go Back to the form and fill out another registration form -”

Registrants are allowed multiple entries under different employee names.


I need to SEND an EMAIL after THIS 3rd page (Registration Form) is Submitted

This form page already has the INSERT to TABLE action step binding.
Then the Redirect to Browser on Success component to Thank You page.

Obviously, I don’t want to affect the working Insert to Table action by installing more action steps to send email. But, apparently, this should work
IF I follow the LOGICAL order of Action Steps & call for them in correct order on the Registration Form itself.

I’ve already followed these steps at the Wappler/docs/wiki/Sending-Form-Data-to-Email

But then the form stopped submitting & the browser redirect stopped.

So for my next try today here’s where I am with the working Post Registration Form page minus Send Email steps.

Can you advise me on the ORDER of my Action Steps on the Left
& the Order in my App Structure?
After I install the Send Email Form Data instructions?

I would guess that no Success & Redirect Browser behavior should occur until after First Posted values are inserted to database table
Send Email has executed successfully?

Or in interest of speed for the user — Post Data & then allow Browser Redirect to Thank you page
followed by Send Email action happening in the Server background?
Then Confirmation of Sent Email (only if Send activated successfully)?

Thank you very much for considering this question, Paul.

Now on to your video!

Well you certainly are getting there, and it seems you are starting to get more comfortable with the flow of the app, so thats great news.

So the logical steps would be, on page 3 which is basically the final completed registration form, when the user clicks the submit button…

  1. The form named “GoToKadeData” in the App Structure should have the SERVER CONNECT FORM Action set to bestregistration/stickinregistration which is your server action. NB: (Make sure this is NOT an onclick event of the form button.

  2. Make sure you have a browser component on your page.

  3. The same form should have an onsuccess set to the browser goto to redirect the page. (This is the success of ALL steps in the stickinregistration server connect action)

  4. In server connect stickinregistration add the Setup Mailer step after the insert named DataintoRegistration.
    NB: Start off small, use the SMTP Type of “Server Default” as the easiest setup first, when its all working flawlessly if you want you could always play wit changing that to full blown SMTP.

  5. After the Setup Mailer step add the Send Mail step.
    Again for testing purposes, first make it as simple as possible and once it is working and you are getting a simple email just saying Test, and you know the app and the structure is great, then go and extend to it with HTML body and Dynamic Data where needed.

This should work perfectly, the POST form action runs the Server Action and waits for success and redirects the browser.

If not send me the code of page 3 please, and screenshots of the server actions Globals $POST / $GET variables, and the Setup Mailer and Send Mail steps, so i can take a look.

It’s just dawning on me that as I add new actions that I have to also ftp over many more files from Wappler to support this Send Email addition to my current website folder.

I have to grab new connections I’ve named, the new actions folders, the files that get bound in the background.

I’ve had to make a new website sub-domain folder to really test if these changes are working.

Too bad the utility isn’t here as in another tool I used – to always sync every file in every folder that had been impacted/modified/ created with the online php pages.

Just add a send mail step after the insert step in the same server action. That’s all - everything required will be uploaded to the active target on saving the server action…

You really make every single task sound really a huge thing in all your comments, while it’s just two steps - add the mail step and save. Easy.

No subdomains, no new connections, no new folders… I really think you are missing some fundamental understanding of how the things work…

1 Like

Wappler adds all required files for everything you add all by itself, and the publish button keeps everything in sync when you want to use that.

No Doubt.

But because I have a LIVE app already taking registration I can’t go messing with the LIVE version already saving events.

THAT is why I make alternate folders that only I see.

I am using FileZilla for the moment.