A little of PHP (server side language) and the "sprintf" function


Ade Wale

Hi David,

What could be the issue with this line of code?

The print is just <> but I am expecting the send name and his/her comment.

Thanks


decsoft

Hello Ade,

At a first view, the "sprintf" function format string appear good, then, if you get "empty" strings, there cannot be other reason than the variables "$name", "$email" and "$comments" are not filled as you expected.



Ade Wale

Hi,

I read about sprintf on the website and after implement the idea I got from their on AB.

This error message came displayed

[img=error.png]https://www.decsoftutils.com/_support/uploads/cd06e80ad6f7f5e082422a18dd2ec7ab.png[/img]

What could be the issue?


decsoft

Hello Ade,

Please, can you provide me with a little application sample in order to try to reproduce the problem here? I can't figure how to help you without an small sample Ade...



Ade Wale

Hi David,

Check your email I have sent the sample project I am playing with.

I tried this php script too


decsoft

Hello Ade,

Two things to note:

1º Your script must respond with an "http_response_code(200);" to avoid the Http Client's Error event to be fired.

2º Take care with the email input. Since they are an email input, for example, Internet Explorer put a value of "undefined" if the input's value is not a valid email address. May you can use the IsEmail action in the application.

Hope this information can help to solve your problem!



Ade Wale

Hi,

I am your PHP script "AS IS" that come with AB.

1. This is line code has take care of respond with an "http_response_code(200);" correct me if I am wrong.



2. The email input has been taking care with this line of code:

$email = filter_input(INPUT_POST, 'EmailInput', FILTER_VALIDATE_EMAIL); and

Regarding the Internet Explorer I am not consider it at the moment because this will be use only in Android platform.

After could of try and error in the PHP script. I have not got it working.


decsoft

Hello Ade,

The "feedback.php" script including in the Calculator sample is the below one:

As you can see we play with response codes, then we can use such response codes our the app.

About the email validation, I note that the variable can become "undefined", which is not "" (empty) but a different thing. Anyway, we always must validate the user's input also in the app's server.



Ade Wale

Hi David,

Thanks issued solved.

AB Ninja rock!


decsoft

Hello!

Hi David,

Thanks issued solved.

AB Ninja rock!

Glad to know!


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.