function myfun()
{
var nm=12;
window.location.href="bkd.php?uid="+nm;
}
<form name="frm" method="GET">
<input type="text" value="ghf" onclick="myfun();"></input>
<input type="hidden" value="" name="txtval" id="txtval"></input>
<?php
echo $_GET["uid"];
?>
</form>
I have added JS and HTML on the same page. Wwhen I execute the code I am getting the value in PHP but it also displays
"Undefined index: uid"
uidquery parameter and use PHP to display it on reload.if (isset($_GET["uid"])) echo $_GET["uid"];. This will check for the existence of the variable before it displays it. It won't exist until you reload the page via your JS function. Therefore this code will stop it trying to display the value when you have first loaded the page manually.