php - How to get Form Element Value using JavaScript -
i trying find value of input element in popup window being opened parent page.
my code below. getting not able pc value input.
<html> <head> <? $pid=$_get['pid']; $cart_url = '../cart.php?action=add&p='.$pid; echo $cart_url; ?> </head> <body> <script language="javascript"> <!-- begin function sendvalue(val){ window.opener.document.getelementbyid('details_<?=$pid?>').value = val; window.opener.location.href='<?php echo $cart_url; ?>&pc='.concat(val); window.close(); window.location.reload(); } </script> <form name="selectform"> <label>enter price:</label> <input id="1" name="details_<?=$pid?>" type="text"></input> <input type="submit" onsubmit="sendvalue(this.value)"></input> </form> </body> </html>
code:
<input id="1" name="details_<?=$pid?>" type="text"></input> <input type="submit" onsubmit="sendvalue(this.value)"></input>
change to:
<input id="details" type="text"> <input type="button" value='send...' onclick="sendvalue(document.getelementbyid('details').value)">
Comments
Post a Comment