troubleshooting Question

how to submit variable to a php page?

Avatar of saleemkhan
saleemkhan asked on
JSP
33 Comments1 Solution310 ViewsLast Modified:

hi all ,
  i am trying to fetch the data from a php page and
do the backend process in jsp page and then submit the result to php page. i am using URLConnection .

code in login.php

<form action="http://abc.com/process.jsp" method="post">
<input name="un" type="text">
<input name="pass" type="password">
<input type="submit" value="Submit">
</form>


code in process.jsp

String un=null;
                String pass=null;
                un=request.getParameter("un");
                out.print("un="+un);
                pass=request.getParameter("pass");
                out.print("pass="+pass);
                boolean result=false;
               if ("un1".equals(un) && "un1".equals(pass))
                {
                  result =true;
                }
               else
               {
                  result=false;
                }
               
                  String myurl="http://xyz.com/xyz/result.php?result="+result;
                  out.print("myurl="+myurl);
                  URL u = new URL(myurl);
                  URLConnection yc= u.openConnection();
                 BufferedReader html = new BufferedReader(new InputStreamReader(u.openStream()));
                  html.close();

 

            } catch (Exception e) {

                  out.print("There is a connectionproblem: " +e.getMessage());

            }

code in result.php

<?php
echo "<br>";
echo "result=";
echo $_REQUEST['result'];
echo "<br>";
?>


my problem is i am unable to print the result fetch from jsp.i think there is some problem in submitting the variable to a php page? am i in the right way? or guide me where i am wrong?

waiting for expert solution.?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 33 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 33 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros