need client side form converts get to a post

Giganews Newsgroups
Subject: need client side form converts get to a post
Posted by:  JRough (jlrou…@yahoo.com)
Date: Tue, 27 Oct 2009

By way of explanation, I get a serialized address list  output from a
database  sent to my local html-javascript client.  This is the
string:
file:///Tiger_HD/Library/WebServer/Documents/clientsidepost.html?q=3Da:4:{i=
:0;s:49:%2244502%20Loneoak%2C%20Lancaster%2C%20CA%2C%2093534%22;i:1;s:50:%2=
23537%203rd%20St%2C%20Ridgefield%2C%20WA%2C%2098642%22;i:2;s:58:%22931%20Al=
abama%20St%2C%20san%20francisco%2C%20CA%2C%2094110%22;i:3;s:0:%22%22;}

I want the local html-javascript client form to convert it to a post
and send it to my php server page.  The location.search should get the
one parameter,
the q=3Dxxxxxx and put it in the first array index which I named q then
it should post the q value so I now have a post I can use to plot
address points on google maps.    I get a response from the php page
but it is not a getting a value for 'q'.  I can put the results when I
click submit if you want below or even show you my php page which
works with a get but I need a post because of url length
restrictions.  Any help is appreciated,
<html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=3D"Content-Type"
content=3D"text/html; charset=3Diso-8859-1">
<title>Demo</title>
<script type =3D"text/javascript">
var gp=3Dnew Array();
var loc=3Dlocation.search;
if (loc){

    loc=3Dloc.substring(1);
    var parms=3Dloc.split('&amp;');

    for(var i=3D0;i&lt;parms.length;i++){

        nameValue=3Dparms.split('=3D');
        gp[nameValue[0]]=3Dunescape(nameValue[1]);

    }

}
var q=3D gp['q'] ;

</script>
</head>
<body onload=3D"
var frm =3D document.forms['pgform'];
frm.elements['q'].value =3D q;
document.forms['pgform'].submit();
">
<form name=3D"pgform" action=3D"http://192.168.1.64/pooglemap2.php"
method=3D"post">
Serialized Address List:
<textarea name=3D"q"></textarea>
<script type =3D"text/javascript">

</script>
<input type=3D"submit" value=3D"show map">
document.write(q.value);
</form>
</body>
</html
--results from php--
( I need the $addr to have the serialized string in it :-(
setAPIKey("ABQIAAAA9Bwvj_jq9ffNHGrXz9VO7xQcgR4zkW-"); $addr =3D $_POST
['q']; var_dump($addr); echo "adrr" . "

". "

"; $addrDecode =3Durldecode($addr); $addrArray=3D unserialize
($addrDecode); var_dump($addrArray); echo "unserialized" . "

"."

"; foreach($addrArray as $key =3D> $value){ $map->addAddress($value); }
$map->printGoogleJS(); ?> showMap(); ?>

Replies