html proxy form converts a GET to a POST for processing with PHP

J

JRough

I have a desktop database application that can send an address string
from an embedded web applet. The only output I can get from this
database is an HTTP GET with the address list. I need to capture this
address list from the GET url then POST the address string to a php
page.
I call this proxy page clientsideform.html. It is a local html page
on the hard drive. This is on a mac. There are reasons why I'm doing
it this way.

In any case, I'm not doing the GET right to get the value that comes
after my web server, the get string addr=" "
----------------------------- clientSidePost.html--------------
<html><head>
<title>HTTP Proxy</title>
<body onload="document.pgform.submit()">
var addressList = GET "file://clientSidePost.html&addr= HTTP/1.0
document.write(addressList);
<form name = "pgform_post" method="post" action="http://localhost/
Soliant/googlemap.php"
<TEXTAREA NAME= addr>
</TEXTAREA>
<INPUT TYPE=SUBMIT VALUE="Show Map"
/form>
</head>
</script>
</body>
</html>
------------------------------
<html><head>
<title>HTTP Proxy</title>
<body onload="document.pgform.submit()">
var addressList = GET "file://clientSidePost.html&addr= HTTP/1.0
document.write(addressList);

<form name = "pgform_post" method="post" action="http://localhost/
Soliant/googlemap.php"
<TEXTAREA NAME= addr>
</TEXTAREA>
</form>
</head>
</script>
</body>
</html>
-------------

This is the output I get:
var addressList = GET "file://clientSidePost.html&addr= HTTP/1.0
document.write(addressList);

I also get an empty field in the form. I want this form to be hidden
and for the php page to be posted instead. I don't want the user to
even see the proxy page in his web browser. I need to get rid of the
blank field.

How do you write out the value of the variable troubleshoot what is
going on? I tried document.write to see the value of addressList but
it didn't work.

Tia,
 
J

Jon Gómez

JRough wrote:
[snip]
----------------------------- clientSidePost.html--------------
<html><head>
<title>HTTP Proxy</title>
<body onload="document.pgform.submit()">
var addressList = GET "file://clientSidePost.html&addr= HTTP/1.0
document.write(addressList);
<form name = "pgform_post" method="post" action="http://localhost/
Soliant/googlemap.php"
<TEXTAREA NAME= addr>
</TEXTAREA>
<INPUT TYPE=SUBMIT VALUE="Show Map"
/form>
</head>
</script>
</body>
</html>
[snip]

Use a validator:

http://validator.w3.org/

Start by fixing all of those errors. The validator even offers
suggestions on how to fix things. That should be a big help.

Here's an example of me cutting and re-writing your first HTML document,
even though I'm still learning how to write valid html:

http://www.pcs.cnu.edu/~jgomez/help.html

For example, if you are trying to use Javascript, you need to add an
opening tag for it. You have your '</script>' but not anything like
'<script type="text/javascript">'. Your Javascript itself also has
errors, if it were to execute.

That will give you an environment in which you can mess around with the
Javascript, with it actually working rather than being, for example,
rendered as text to the page.

Jon.
 
J

JRough

JRough wrote:

[snip]
----------------------------- clientSidePost.html--------------
<html><head>
<title>HTTP Proxy</title>
<body onload="document.pgform.submit()">
var addressList = GET "file://clientSidePost.html&addr= HTTP/1.0
document.write(addressList);
<form name = "pgform_post" method="post" action="http://localhost/
Soliant/googlemap.php"
<TEXTAREA NAME= addr>
</TEXTAREA>
<INPUT TYPE=SUBMIT VALUE="Show Map"
/form>
</head>
</script>
</body>
</html>

[snip]

Use a validator:

 http://validator.w3.org/

Start by fixing all of those errors.  The validator even offers
suggestions on how to fix things.  That should be a big help.

Here's an example of me cutting and re-writing your first HTML document,
even though I'm still learning how to write valid html:

 http://www.pcs.cnu.edu/~jgomez/help.html

For example, if you are trying to use Javascript, you need to add an
opening tag for it.  You have your '</script>' but not anything like
'<script type="text/javascript">'.  Your Javascript itself also has
errors, if it were to execute.

That will give you an environment in which you can mess around with the
Javascript, with it actually working rather than being, for example,
rendered as text to the page.

Jon.

thanks, I will try the XML_HTTP request and thanks for the validator.
p.s. I didn't put in the begin javascript tag because I didn't know
if it went before the form tag.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top