1

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

asked Oct 31, 2013 at 0:03
2

1 Answer 1

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:

http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml

answered Oct 31, 2013 at 0:07
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.