Registration error

is this the problem ?

"responseType":"text"

No, that’s the “responseType” key. You’re looking for “response”.

Rob

I see this response line :

"response":"Connected successfullysuccess",

It doesn’t look like anything is wrong with it . Does that mean the problem is with corona ?

Can you tell me what this means ?

In your Lua code, you have an if statement that is comparing event.response to the string “success”. Are you getting a string “success” back from your PHP script?

No, you’re not. You’re getting the string “Connected successfullysuccess”.  Why is your script outputting that instead of outputting “success”? 

This is the basic debugging that you need to do to solve these problems. If you look through your PHP script, it should be very obvious what is causing the problem…  Every bit of text your PHP writes out (with the echo statement) ends up being put into event.response.

Rob

Thanks. It works

How do I show the PHP errors to the user ?

Just to make sure the fix is correct, all you needed to do was was simply remove this line:

echo "Connected successfully";

from your PHP script. That extra text was being output with your success message which caused the string to not match.

As for notifying your user, are basically doing that correctly. Your other error conditions return something other than success and that will cause your dialog box to show up.  Now a change I would suggest would be to change:

local alert = native.showAlert( "Error Signing Up", "There was an error signing up.", { "Try again" } )

to:

local alert = native.showAlert( "Error Signing Up", event.response, { "Try again" } )

That way you show the user what the PHP script is complaining about. Then you can go and 

Rob

wow thanks

Do you think you could help with my other question on here ?

 local parameters = {} parameters.body = "Register=1&username=" .. username.text .. "&pw=" .. pw.text .. "&pw2=" .. pw2.text .. "&email=" .. urlencode( email.text ) local URL = "http://hash.net16.net/register.php" network.request(URL, "POST", networkListener, parameters)

Sending user names and passwords as plain text is criminal!  Encrypt your data and decrypt it in PHP.