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!


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.