File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes How to post data from android app to php page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to post data from android app to php page" Watch "How to post data from android app to php page" New topic
Author

How to post data from android app to php page

Koh Khai Huat
Ranch Hand

Joined: Aug 05, 2005
Posts: 100
Dear friends,

I would like to find out how do i go about posting data into a php scripted file on a webserver??

regards
Alex Koh

Below is the code which i had implemented but does not seems to work. Also posted is the php script.



This is the php file.

<head>
PHP Insert
</head>

<form action="insert.php" method="post">

Key information
<input type="text" name="information" />

<input type="submit" name="submit" value="Click Me">

</form>
<?php
if(isset($_POST['submit'])==true) {
$information = $_POST["information"];
print("You are welcome");
$con = mysql_connect("localhost:3306","RICHARD","1234");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("dip", $con);
/*
mysql_query("INSERT INTO post (word)
VALUES ('QQQ')");
*/
//$information = "JUST WORLD0";
print($information);
//$query = "(INSERT INTO post(word) VALUES ('" + "EXAMPLE" + "')";
$query = "INSERT INTO post(word) VALUES ('$information')";
//$result = mysql_query("SELECT ssn FROM employee WHERE fullname = '$tmpVar'");
//$query = " INSERT INTO post (word)
//VALUES ('qqqq')";
mysql_query($query);
mysql_close($con);
}

?>

if (!WorkHard){
System.out.println("Fail!!!");
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to post data from android app to php page
 
Similar Threads
App wont connect to my database?
Post the data to Server
Application nor run in the background
sending array using namevaluepairs in http post
Httppost Problem