Friday, November 16, 2012

Two onclick events with a php if and else statement – in one button

I have the above below already functional on my website. It works alright but right now, I want to create a kind of promo and if the display meets the criteria of the promo, I want it to display onclick \’$htx\’



<?php
echo \"<a href=\'javascript:;\' onclick=\'pkgsPopup(\'http://\'.$hLnk\');\' rel=\'nofollow\'>\";
?>


I have \’$htx\’ pre defined to open a link \’$dealpath\’ and if it does not meet that condition, I want it to open the default link – \’$hLnk\’


I have tried the code below and I had an error _ I mean the page will not load at all



if ($htx) { echo \"onclick=\\\'miaPopup(\'http://$dealPth\');\\\'\' } else { echo \'onclick=\\\'pkgsPopup(\'http://$hLnk\');\\\'\' }\";


I will really appreciate if someone can let me know how to do this without error using the php if/else statement.


Thanks






Rating: 4 out of 5 based on 5 ratings



The post Two onclick events with a php if and else statement – in one button appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/two-onclick-events-with-a-php-if-and-else-statement-in-one-button.html

No comments:

Post a Comment