Post to PHP

sigster

Active Member
Licensed User
Longtime User
Hi

I have php form online I need to send text to the form and submit the button
can anyone help me with this Please how this works
can I use WebView1

B4X:
   <html>
<head>
<title>TITLE </title>
</head>
<body>
<img src="logo.gif" alt="ME" height="27" width="70"  />
<FORM action="/index.php" method="post">
    <P>
    <Label For="NUMBER">Your number: </Label>
              <INPUT Type="text" id="NUMBER" name="number">
    <INPUT Type="submit" value="Send">
    </P>
 </FORM>
 <hr>

</body>
</html>


Regards
Sigster
 

sigster

Active Member
Licensed User
Longtime User
Hi

I am using WebView to show the form
don't have access to the script :)

was try to make text box to send to the online form
then I can change the sortkeyboard in the form
EditText.INPUT_TYPE_PHONE

Regards
sigster
 
Upvote 0

admac231

Active Member
Licensed User
Longtime User
I made an example tailored to you what you need. It uses HttpUtils2.

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim etNumber As EditText
   etNumber.Initialize("etNumber")
   Dim cmdSubmit As Button
   cmdSubmit.Initialize("cmdSubmit")
   cmdSubmit.Text = "Submit"
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.AddView(etNumber, 10, 10, 100%x-20,100)
   Activity.AddView(cmdSubmit, 10, 110, 100%x-20,100)
End Sub

Sub cmdSubmit_Click
   Dim jobPost As HttpJob
   jobPost.Initialize("JobPostName",Me)
   jobPost.PostString("http://...../index.php","number="&etNumber.Text)
End Sub

Sub JobDone (Job As HttpJob)
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        Select Job.JobName
            Case "JobPostName"
                ToastMessageShow("Success!", True)
        End Select
    Else
        Log("Error: " & Job.ErrorMessage)
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

I didn't have a form to test with unfortunately so the post data (""number="&etNumber.Text") may have to be edited.
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Thanks ! @admac231

this works I get Success
ToastMessageShow(Job.GetString, True) see the info
, will try this better to night


Regards
Sigster
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Still working :)

did have character problem so I change Httpjob UTF8 to 8859-1

Thanks

Regards
Sigster
 
Upvote 0
Top