conrad10781 Posted May 26, 2006 Posted May 26, 2006 Right now I'm trying to have a link that passes a parameter from a php array, that before it executes has a javascript popup confirmation box. I've tried to do it a few times, but the quotes keep delimiting each other in different languages and I'm not sure how to get around this. currently my link looks something like this: <?php echo' <a onclick="If window.confirm(document.location='asdf.com?id=' . $dataArray[$index] . ' ">'; ?> blah blah </a> I think I'm making this a lot harder than it needs to be...
kgt Posted May 26, 2006 Posted May 26, 2006 Try <?php echo'<a onclick="If window.confirm(document.location=\'asdf.com?id=' . $dataArray[$index] . '\'">';?> Contributions Discount Coupon Codes Donations
conrad10781 Posted May 26, 2006 Author Posted May 26, 2006 That's my current code and it's still not working :-/ <?php echo' <a onclick="If window.confirm(document.location=\'pay_commission.php?skin_id=' . $products['id'] . '\'">'; if($products['commission_total'] >= 50){ echo "<b>Payment Due</b>";} else { echo "No Payment Due"; } ?></a>
kgt Posted May 26, 2006 Posted May 26, 2006 Now your PHP syntax looks correct, but you have a least one obvious Javascript syntax error. You never close this function: window.confirm( Look at your HTML source to see what the printed Javascript looks like. This will help you determine your JS errors. Contributions Discount Coupon Codes Donations
conrad10781 Posted May 26, 2006 Author Posted May 26, 2006 that's what I get for just copying and pasting your code :-P
conrad10781 Posted May 26, 2006 Author Posted May 26, 2006 So this is what my source says... and I'm baffelled that it doesn't work: <a onclick="If window.confirm(document.location='pay_commission.php?skin_id=1')">No Payment Due</a>
kgt Posted May 26, 2006 Posted May 26, 2006 wow, I'm going blind... Yeah, I'm not even sure how to answer you 'cause I can't even tell what's supposed to be happening. You will need an href to get a clickable link. And I'm not sure what you expect to happen with window.confirm(document.location='pay_commission.php?skin_id=1'). Contributions Discount Coupon Codes Donations
conrad10781 Posted May 26, 2006 Author Posted May 26, 2006 yeah, I got it working fine... you can use text as a link in just an onclick. I didn't realize until I just looked at it I was trying to confirm the url I was going to instead of having a message... yikes I'm going home before I lose my mind. Thanks for all the help however, you're a super duper guy.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.