stop preventing HTML code rendering with Return and Die function in php -


as know in php script when call return or die prevents rest of html codes rendering.

in occasion when want stop php script not whole page do?

ex:

<?php if(!isset($_post['txt_username'])) {     echo "please enter username";     return; } ?> <i want="this html">to rendered</i> 

i want html codes rendered afterward. reading.

your question not clear, need stop php code execute, html render? might need output buffer or functions.

e.g.:

<form action="" method="post" >     <input type="text" name="txt_username" />     <input type="submit" /> </form>  <?php function dosmth(&$password) {     if(!isset($_post['txt_username']))     {         echo "please enter username";         return false;     }     $password .= "333";     echo "you password has been changed $password"; }  $password = 128; dosmth($password); ?> <body>     <p> <b> password <?= $password; ?> </b></p> </body> 

examples:

  • text field set:
  • output:

    you password has been changed 128333

    your password 128333


  • text field not set:
  • output:

    please enter username

    your password 128


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -