Can we assign $_POST[“some value”] to a $var using php? like $transName = htmlspecialchars($_POST[“transName”]);

enter image description hereenter image description hereIn android onclick I am passing a string to php using httpurlconnection and with that string I am trying to make a query that will select only those values which match the string?

require "init.php";
$transName = htmlspecialchars($_POST["transName"]);
$sql_query = "select * from trans_info where transName like '$transName';";
$res= mysqli_query($con,$sql_query);
$result= array();
while($row = mysqli_fetch_array($res))
echo json_encode(array("result"=>$result));

enter image description here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s