Hi,
Am having only one check box.

I wants to pass checkbox values through hyperlink. I needs to know, either it is an checked checkbox or an unchecked uncheckbox. Based upon checked checkbox, i carry out my remaining coding part.

echo "<br>";
	echo "<table>";
	echo "<tr><td colspan='2'><font color='blue'><b>download PDF document:</b></td></tr>";
	echo "<tr><td><b>Approve :</b><input type=checkbox name=chk value=no></td><td><a target ='_blank' href='download.php?chk=no&pid=".base64_encode($id)."'>Approve it</a></td></tr>";
	echo "</table>";

Please give me the solution to sort out my problem.thanks

So you want to pass the values of the checkboxes into the hyperlink, don't you?
If so, then you can use Javascript like the following:

echo '<script type="text/javascript">
  function changeHREF(A_ID,ChkBOX){
    document.getElementByID(A_ID).href="download.php?chk="+ChkBOX+"&pid='.base64_encode($id).'";
  }
</script>';

And the PHP-HTML code should become like:

echo '<br>
	<table>
	<tr><td colspan="2"><font color="blue"><b>download PDF document:</b></td></tr>
	<tr><td><b>Approve :</b><input id="ChkBOX" type="checkbox" name="chk" value="no" onclick="changeHREF(\'HREF1\',\'ChkBOX\')"></td><td><a id="HREF1" target="_blank" href="download.php?chk=no&pid='.base64_encode($id).'">Approve it</a></td></tr>
	</table>';

I hope it helps.

Hi,

thanks for your coding. Problem is there :
How can i find :
checked / unchecked.

If i unchecked my checkbox means, values should not pass.(user not allowed for downloading)
if i checked my checkbox means, values should pass.(now the user are allowed for downloading)

thanks

javascript is not working...onclick

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.