How to pass something to an existing PHP file

What are you trying to achieve exactly?

Can somebody please answer my question if it’s possible? I’m afraid I will get to frustrated with Wappler and leave it. Too much hurdles for me.

Can I execute the PHP code, and if so how?

The idea of Wappler is not to run third party PHP codes inside.
Please answer my question, so I can help you - what is the desired result? What you want to do/change and where? What needs to be done?

I know that’s the idea of wappler… I have been through this for an hour on skype with @psweb - he suggested you could help me with the exec code.

The idea that I am getting from @nevil is that he wants to pass variables to a program called SqltoWOPO.php. The program then interacts with a cloud based company called MRPEasy

Rather than using the process above, it should be ‘easy’ (pun intended) to communicate with the cloud based company by using the MRPEasy API’s, which is the Wappler way.

So, to answer @nevil’s question, when pressing the Bestel button, it should communicate your intentions using an API rather than an external PHP file.

Unfortunately, I have not worked with API’s enough to help out. I hope @psweb does not mind me dobbing him in.

1 Like

If that’s the case, using server API is better than trying to call a custom PHP code.
And that’s why asked what the PHP code is supposed to do actually :slight_smile:

You pretty much have the idea @ben. I had a lengthy skype chat with Nevil so have a bit of an understanding of what he wants to achieve.

He has a backend ordering management / time management system for his company. It is already working from a bunch of custom built php files that were created for him previously, all he would like to do, is recreate what is already working but from within Wappler so he can make it prettier and maybe later on add some functionality.

It all starts off with a simple table which he has working in wappler, this table basically has a single input of quantity and an order button for every product.

The user enters a quantity and hits the order button, which then needs to send the quantity and product SKU to an external API called MRPEasy.

For this he is trying to use the Server Side API Component, which he is running into some issues using, and this is probably where the focus should really be. It is not really getting the schema as it should, and he needs to get the response from the API to use in a second operation.

This whole question about running a custom PHP script is just because he already has a custom built PHP script called SqltoWOPO.php from his previous system that can interact with the MRPEasy API and is known to work for his needs.
I have suggested he ignore this custom PHP file and focus on getting it to work directly in Wappler. Because I have not had a chance to really become an expert on the Server Side API myself I can not really assist him properly, so I suggested that he give me a little time to become more familiar with the Server Side API and then I will probably be able to help him much more effectively.

In the meantime while he waits for me, he is trying to continue, but still along the course of running the custom script onclick of the Order button, which I said to him I am uncertain of if or how to make that work and maybe to ask the question and see if @Teodor might know, if he could make a custom php script run using the onclick event on a button.

Anyway I hope this clarifies a little of what he is trying to do.

1 Like

Thanks Paul,
That’s what I needed as an explanation and thank you for providing it.
The API tools are indeed the way to go instead of calling custom PHP files.

1 Like

@nevil to get help from the community instead of waiting for me I would suggest that you take a few screenshots inside Wappler, of your page with your table on it, also your Server Action which is trying to interact with the MRPEasy API and just skip the entire idea of trying to get Wappler to run the old / currently working PHP script you already have.

Try explain clearly what you want to send the API and what it should return, with screenshots where possible.

1 Like

Your reaction is exactly why I didn’t want to explain the full situation. It would have taken me a lot of time to write it out, and your only response is: “ok got it, do it like we say anyways, goodbye.” So frustrating.

What i am saying is - using the API tools in Wappler is the way to go.
If you are experiencing any issues using API tools for this, please report them here so we can help you.

Nothing in my reply is (intended to be) negative or to insult you. I am just trying to explain how to do it with Wappler.

@nevil, there are many different people and different languages which always has the possibility to cause confusion of misunderstandings.

Teodor is not saying goodbye, he is saying ok he understands now, now lets continue and sort out the actual issue at hand, lets get some screenshots like i suggested on the Server Side API and from there we can all start giving specific advice to a very broad question.

I just don’t get why you wouldn’t say something like: “yes it’s technically possible, like so and so, but really not recommenced because so and so. And we would suggest doing it like this and this” - instead I get something like “just do what we say”. If this company is going to succeed for a more general audience then your customer service needs an empathetic/humanized upgrade. But maybe that’s not the intended audience, I don’t know. Take your cues from Paul, he is a great example how to explain things.

Anyway I have already submitted multiple topics, one of which isn’t answered.


You want to fire off a PHP file on form submit?

Have you tried something like:

<form action="SqltoWOPO.php" method="post">
 <p>SKU: <input type="text" name="sku" /></p>
 <p>Quantity: <input type="text" name="quantity" /></p>
</form>
<?php
    if(isset($_POST['Submit'])) {
        $sku= $_POST['sku'];
        $quantity = $_POST['quantity'];
?>
1 Like

Thanks Dave, I will give it a try!

I believe i already answered your question. And i also think that the whole problem is not my answer, but the fact you don’t like the answer (i.e. it’s not a confirmation you should do it that way).

As for the topics you posted, as you can see Patrick has been assigned to investigate and fix one of the reported issues and George is still waiting for you to answer his questions in the other topic. :slight_smile:

The team here, and the community, will go out of their way to help you, believe me I have asked for so much help. Questions far beyond Wapplers scope on occasion. Everybody is trying to help here. Yes it can be frustrating but Wappler, the Team, or the Community, are not to blame here. They should be thanked. Now I’m not sure if what I posted above will help? Maybe… But regardless it’s a two way street here. Sometimes you will have to give way, compromise, find a solution out of the box. Sometimes legacy code is the issue. And alternatives needs to be worked out. I’d love it if Wappler could muck out my two horses… That’s not Wapplers job though, but damn I’m going to suggest it as a feature request regardless! :smiley:

@nevil Did this work for you?

I eventually achieved the same by using an API action to that PHP file. My programmer then would catch that API call (with the variables in that call) and then would execute the PHP file like I wanted (see first post in this topic).

The PHP file has some built in security to mitigate the less secure method of API calling a public PHP file. It’s a bit of a crude workaround, but it works.