View Full Version : Enable Paypal link after authorization checkbox

Jul 29, 2009, 07:06 PM
I'm trying to figure out a way to have one of those 'by checking this box, you agree to the policies, etc.' checkboxes on a webpage that then enables them to click on the PayPal button on the same page, which takes them to PayPal to purchase the item.

Anyone have an idea of a PHP script that could do something like this?

Jul 30, 2009, 09:04 AM
PHP can't do it alone. It requires JavaScript. PHP would just check things server-side. Though, you have to remember that some people have JavaScript required so you need to make sure the button is enabled by default, otherwise they won't be able to enable it when the check the box.

<input type="checkbox" id="agree" name="chkbx">I so agree!!
<input type="button" id="paypal" value="Paypal">
<script type="text/javascript">

function Init() {
document.getElementById('paypal').disabled = true;
document.getElementById('agree').onclick = TogglePaypal;
function TogglePaypal() {
var toggle = document.getElementById('paypal').disabled;
document.getElementById('paypal').disabled = !toggle;
window.onload = Init;