I got a javascript for send value to a Popup but only works with $_GET['value'] because when a change to $_POST['value'] it shows this message
Notice: Undefined index: value in C:\wamp\www\corti\presupuestos\precio.php on line 10
this is the javascript code
function envia(){
var co = $("#codart").val();
var pag = 'precio.php?value='+co;
window.open(pag,'Popwin','height=400, width=400');
}
this is the button
<img src="../png/buscar.png" height="16" width="16" onClick="javascript: envia();">
and this is de popup php file
<?php
$c=$_POST['value'];
echo $c;
?>
thanks for you help and your time
-
Ah, this question has the answer stackoverflow.com/questions/5554896/window-open-postPopnoodles– Popnoodles2013年10月31日 00:24:08 +00:00Commented Oct 31, 2013 at 0:24
-
Possible duplicate of Window.open and pass parameters by post methodUlad Kasach– Ulad Kasach2016年05月18日 19:33:01 +00:00Commented May 18, 2016 at 19:33
1 Answer 1
this is because $_POST can't read url strings query. and you are sending your variable in url string query.
that's why you have to use $_GET in your case.
Otherwise, you need to use ajax such as mentioned in many websites articles to perform post.
and here's one for example: