I have a html form whose data is fetched by a PHP file. Inorder to further manipulate the data, I want it to be sent back to a java file. I'm a newbie. Any help will go a long way.
HTML Code:
<html>
<head>
<title>Console App</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-4 col-md-offset-4 vert-offset-top-8">
<img class="img-responsive text-center" src="img/logo.png">
<br/>
<div class="well well-lg" id="well">
<form class="form-horizontal" action="ServLogin" method="POST">
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Username</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="v_username" placeholder="Username">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-3 control-label">Password</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="v_password" placeholder="Password">
</div>
</div>
<button type="submit" class="btn btn-primary btn-block" name="submit" value="submit">Sign in</button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
PHP Code:
<?php
$uname = $_POST["v_username"];
$pwd = $_POST["v_password"];
$submit = $_POST["submit"];
$conn = mysqli_connect("localhost","root","","vconsole");
$array = array('username' => $uname,'password' => $pwd );
if($conn){
if($submit)
echo json_encode($array);
}
else{
echo '<h1> failed </h1>';
}?>
How to fetch the encoded json array in java ? I'm currently working in XAMPP.