Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
added 163 characters in body; deleted 26 characters in body
Source Link
aretecode
  • 334
  • 1
  • 5

 

 

endif

endif-stackoverflow

Or like this:Or like this:

Or like this:Or like this:

Or even this (probably not the best idea though):short tags

short hand comparison (ternary)

ternary 2

Or even this (probably not the best idea though):


 

 

and again in the first styleand again in the first style:


 

 

Or like this:

Or like this:

Or even this (probably not the best idea though):


 

 

and again in the first style

endif

endif-stackoverflow

Or like this:

Or like this:

short tags

short hand comparison (ternary)

ternary 2

Or even this (probably not the best idea though):

and again in the first style:

Source Link
aretecode
  • 334
  • 1
  • 5


This could be written like this:


<?php if (showmessage($msg)): ?>
    <script>
        $(document).ready(function (){
            jqxAlert.alert('Alert Message');
        });
    </script> 
<?php endif; ?>

Or like this:

<?php if (showmessage($msg)) { ?>
    <script>
        $(document).ready(function (){
            jqxAlert.alert('Alert Message');
        });
    </script> 
<?php } ?>

Or like this:

<?php 

    if (showmessage($msg)) { 
        echo
        '
            <script>
                $(document).ready(function (){
                    jqxAlert.alert(\'Alert Message\');
                });
            </script> 
        ';
    } 

?>

Or even this (probably not the best idea though):

<?= (showmessage($msg)) ? '<script>$(document).ready(function (){jqxAlert.alert(\'Alert Message\');});</script>' : ""; ?>

Alternatively, if you mean you would like to put the error message in that alertbox


<?php 

    if (showmessage($msg)) { 
        echo
        '
            <script>
                $(document).ready(function (){
                    jqxAlert.alert('.showmessage($msg).');
                });
            </script> 
        ';
    } 

?>

and again in the first style

<?php if (showmessage($msg)): ?>
    <script>
        $(document).ready(function (){
            jqxAlert.alert(<?= showmessage($msg) ?>);
        });
    </script> 
<?php endif; ?>