Page 1 of 1

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

Posted: Mon Jul 25, 2005 4:30 am
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

Posted: Mon Jul 25, 2005 5:08 am
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.

Posted: Mon Jul 25, 2005 5:45 am
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;
}
?>