I know is a silly question but I thought I should ask since you guys know more about postgresql. Sorry for being analytical, but I think its the only way to make my question clear.
I'm using postgresql 9.1 /postGIS 2.0 /openlayers/geoserver and apache
I've managed to get a feature's fid when clicked from a vector layer. I edited it using javascript and kept only the number, for example 64.
Then I set this as a value of a hidden html form. Using ajax I m trying to pass this value to a PHP value and perform a query. Openlayers, javascript and ajax work fine but php never gets the value. Here is my code
function selected_feature(event){
var sf = event.feature.fid;
var sfs = sf.split(".");
//that's the number out of fid
var sff = sfs[1];
//feed it to the form
document.getElementById("blahhh").value=sff;
//alert it-works
alert(document.getElementById("blahhh").value);
//call ajax
loadXMLDoc();
}
<!--the form-->
<form id="hifo" name="hifo" method="post">
<input type="hidden" id="blahhh" name="blahhh" />
</form>
//outside openlayers code
function loadXMLDoc(){
var xmlhttp2;
alert("inside");//works
var t2lFname=document.getElementById("blahhh").value;
var parb="blahhh="+t2lFname;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp2=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp2.open("POST","map.php",true);
xmlhttp2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp2.send(parb);
xmlhttp2.onreadystatechange=function()
{
if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
{
alert("suces");//works
}
}
//and then php
$blah = $_POST['parb'];
echo $blah;
$queryd='
SELECT
pins.p_name
FROM
pins
WHERE
pins.p_id='.$blah;
//fetching to fill array
$resultd=pg_query($conn, $queryd);
$nord=pg_num_rows($resultd);
$d=0;
while($arrayd=pg_fetch_array($resultd)){
$name[$d]=$arrayd['p_name'];
$d++;
echo $arrayd['p_name'];
echo $arrayd[$d];
echo $d;
}
So basically use the fid as an id, via ajax to query the db. All this code is in the same file (named map.php).Problem is php's echos not working and query not working at all. I ve searched the web, I red tutorials and still no luck. Everything works except php. What should I do? Please advise
Thanks
PS I also tried OpenLayers.Request, found here and still no luck

echo "foo";so you can determine, whether problem is in your PHP code, or in JavaScript AJAX call. If it works, continue withvar_dump $_REQUEST;Also, I would suggest using OpenLayers.Request or jQuery's AJAX functions. Oh, and most important thing: examine request in Firebug. – user1702401 Feb 6 at 7:28echo'test';before my query and gets rendered. I believe the biggest problem is that I'm new to ajax/jquery and I havent found a tutorial about passing values in the same file. So I'm kind of voodoo-coding here. You guys know a good tutorial or can you give me some guidelines or something? Thanks – slevin Feb 7 at 0:54jQuery.post("testone.php", { jas : sff }, function(data) { //pass data to php var });}Thanks again.... – slevin Feb 8 at 23:07