FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Simple example send data to php form
Simple example send data to php form
Débuté par Peter Muckle, 03 sep. 2015 18:13 - 3 réponses
Connectez-vous…
Peter Muckle
#1
Posté le 03 septembre 2015 - 18:13
Hi All,
I am still scratching my head as to how to send data from an Android app via httpsendform and a php site and wondered if someone could help.
I have a php form with 3 fields; UID, Name and photo, and a 'Save' button. This can be filled in directly online, eg
www.mysite.com/TestTable_add.php
What code do I need to send the data from an Android app and save on the server? Also, what is the approach with images when uploading into a database, or into a folder with a reference on the database?
for example if the photo is going into an image field:
HTTPCreateForm("FORM")
HTTPAddParameter("FORM", "UID", "100")
HTTPAddParameter("FORM", "Name", "Test Name")
HTTPAddParameter("FORM", "Photo", "??????")
HTTPSendForm("FORM", "
www.mysite.com/TestTable_add.php
")
Is this correct? I'm not sure which IP address I should be using, for example.
Thanks
Pete
Signaler
0
0
Allard
#2
Posté le 03 septembre 2015 - 21:15
Hi Pete,
I think you better make a webservice then sent from the mobile app to the webservice and let the webservice do the saving .
regards
Allard
Signaler
0
0
KJVA
#3
Posté le 04 septembre 2015 - 08:39
look in this thread:
http://forum.pcsoft.fr/en-US/pcsoft.us.windevmobile/1232-upload-image-with-httprequest/read.awp
Signaler
0
0
Peter Muckle
#4
Posté le 04 septembre 2015 - 13:37
OK I have a very simple version working, using php and MSSQL
WM form with two fields (EDT_TestID and EDT_Name) and a 'send' button.
Button code:
nTestID is string = EDT_TestID
sName is string = EDT_Name
HTTPCreateForm("FORM")
HTTPAddParameter ("FORM", "TestID", nTestID)
HTTPAddParameter ("FORM", "Name", sName)
HTTPSendForm ("FORM", "
www.website.com/data_input.php
")
file called data_input.php at website.com:
<?
$objConnect = mssql_connect("server.com","user","password");
$objDB = mssql_select_db("databasename");
$strSQL = "INSERT INTO TestTable ";
$strSQL .="(TestID, Name) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["TestID"]."','".$_POST["Name"]."') ";
$objQuery = mssql_query($strSQL);
if($objQuery)
mssql_close($objConnect);
?>
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte