how to display a message box in php (newbie)?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php12342005
Forum Commoner
Posts: 79
Joined: Mon Mar 21, 2005 3:35 am

how to display a message box in php (newbie)?

Post by php12342005 »

hi all,
could you show me php code to display a message box (similar to alert("..") function in html)?

E.g.
<?php
if(isset($_POST['form_Submit']))
{
alert('Is sent by submit button');//message box
}
?>

acturally, my purpose is for contacting to mysql, if the user doesn't exist, php will show a message box - anyway, code above is simple.

thanks
Revan
Forum Commoner
Posts: 83
Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:

Post by Revan »

Code: Select all

if( isset($_POST['form_Submit']) )
{
echo '<script language="javascript">alert(\'Rwar\')</script>';
}
or, if you want:

Code: Select all

if( isset($_POST['form_Submit']) )
{
echo <<<JAVASCRIPT
<script language="javascript">alert('Rwar')</script>
JAVASCRIPT;

}
Or such, there isn't a built in function for display them.
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

OR if you wish to make it a bit more standards compliant HTML

Code: Select all

<?php
if(isset($_POST['form_Submit']))
{
echo <<<JAVASCRIPT
<script type="text/javascript">
document.onLoad=alert('Rwar')
</script>
<noscript><p>Rwar</p></noscript>
JAVASCRIPT;
}
?>
Post Reply