doubt touch events

sorry for the inconvenience, before I opened a post that I’ve been able to solve by myself. Now the question I have is:
-I have some variables that get sent through a php page.
The problem is that when I give the submit button I have in my application, it sends it twice (Pressing des-click and press the button). What I do is the following:

Create a function that records the click at all stages (pressed and ended).

But I do not know how to do it and I tried to use the following code and could not.
Any suggestions?

local function onObjectTouch( self, event )  
 if event.phase == "began" then  
print("touch began")  
 -- Touch has began  
  
 elseif event.phase == "moved" then  
print("touch moved")  
 -- User has moved their finger, while touching  
 timer.performWithDelay( 1, enviar\_variables, 1 )  
 elseif event.phase == "ended" or event.phase == "cancelled" then  
print("touch ended")  
 -- Touch has ended; user has lifted their finger  
  
 end  
  
 return true -- IMPORTANT  
end  
  
share = display.newImageRect("share.png", 200, 100)  
share.x = 200; share.y = 325  
share:addEventListener( "touch", onObjectTouch )  
  

Thanks! [import]uid: 98258 topic_id: 32613 reply_id: 332613[/import]

Please, provide us with all code. That snippet doesn’t do anything but handles events.

One note, i never use self in the declaration of the function. Just the event.

Joakim [import]uid: 81188 topic_id: 32613 reply_id: 129723[/import]

I know it does not do anything so I want to know how should I implement it correctly, is that the code is an image that when you click the function will put and there goes and the other, the problem is that not even messages that get printed so I suspect that the code does not work.
Any suggestions?
Thanks for your help! [import]uid: 98258 topic_id: 32613 reply_id: 129727[/import]

Try to remove “self” in the function header.

Joakim [import]uid: 81188 topic_id: 32613 reply_id: 129729[/import]

Please, provide us with all code. That snippet doesn’t do anything but handles events.

One note, i never use self in the declaration of the function. Just the event.

Joakim [import]uid: 81188 topic_id: 32613 reply_id: 129723[/import]

I know it does not do anything so I want to know how should I implement it correctly, is that the code is an image that when you click the function will put and there goes and the other, the problem is that not even messages that get printed so I suspect that the code does not work.
Any suggestions?
Thanks for your help! [import]uid: 98258 topic_id: 32613 reply_id: 129727[/import]

Try to remove “self” in the function header.

Joakim [import]uid: 81188 topic_id: 32613 reply_id: 129729[/import]