0

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

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by jacksantho
0

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.

Edited by Pro2000: n/a

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.