Saturday, November 17, 2012

htaccess allow access php specific file

<Files ~ "^piwik\.(js|php)|robots\.txt$">
    Allow from all
    Satisfy any
</Files>

how to post data to other page using javascript and php

<script  language="javascript">
function postdatasend(data){
var pnamevalue=document.getElementById('prname'+data).value;
var ppricevalue=document.getElementById('prprice'+data).value;
var mapForm = document.createElement("form");
    mapForm.target = "Map";
    mapForm.method = "POST"; // or "post" if appropriate
    mapForm.action = "showsingleproduct.php";
    mapForm.target='_self';
var pname = document.createElement("input");
    pname.type = "hidden";
    pname.name = "proname";
    pname.value = pnamevalue;   
    mapForm.appendChild(pname);
   
var pprice = document.createElement("input");
    pprice.type = "hidden";
    pprice.name = "proprice";
    pprice.value = ppricevalue;   
    mapForm.appendChild(pprice);
    document.body.appendChild(mapForm);
    mapForm.submit();

return true;
}
</script>

<input type="hidden" id="<?php echo 'prname'.$formcounter?>" name="<?php echo 'pro'.$formcounter?>" value="<?php echo $productArray['Productname']?>">
<input type="hidden" id="<?php echo 'prprice'.$formcounter?>" name="<?php echo 'pro'.$formcounter?>" value="<?php echo $productArray['Price']; ?>">


<a href="javascript:return void(0);" onclick="javascript: return postdatasend('<?php echo $formcounter?>');"> send data</a>