Jump to content

[SOLVED] displaying text or error help


runnerjp

Recommended Posts

hey guys i can seem to figure this out but at the moment i have this code

 

<?php	if ( isset ( $error ) )	{ echo '			<p class="error">' . $error . '</p>' . "\n";	}	?>
<?php	if ( isset ( $msg ) )	{ echo '			<p class="msg">' . $msg . '</p>' . "\n";	} else {//if we have a mesage we don't need this form again.?>

 

but how will i make it so if the is not displayed it says

 

any errors will be displayed here!

 

used if's and else statements but aint really coming together

Link to comment
https://forums.phpfreaks.com/topic/78673-solved-displaying-text-or-error-help/
Share on other sites

You just have to check to see if neither string is set:

<?php
if (isset ( $error))
        echo '<p class="error">' . $error . '</p>' . "\n";
if (isset ($msg))
       echo '<p class="msg">' . $msg . '</p>' . "\n";
else
   //if we have a mesage we don't need this form again.
if (!isset($error) && !isset($msg))
      echo 'any errors will be displayed here!';
?>

 

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.