Current location: Hot Scripts Forums » Programming Languages » PHP » alert box in PHP


alert box in PHP

Reply
  #1 (permalink)  
Old 06-10-08, 08:28 AM
reetha26 reetha26 is offline
Newbie Coder
 
Join Date: May 2008
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
alert box in PHP

hie there... i have this PHP code below. Instead of prompting the error message in next page, i want to prompt in an error box. how do i do this? Thanks.

PHP Code:

if($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg'
{
    echo 
"Sorry, we only allow uploading GIF images";
    exit;

Reply With Quote
  #2 (permalink)  
Old 06-10-08, 10:23 AM
bizzar528's Avatar
bizzar528 bizzar528 is offline
Community Liaison
 
Join Date: Sep 2004
Location: Pennsylvania, US
Posts: 1,550
Thanks: 2
Thanked 16 Times in 15 Posts
PHP is a server side language, it can't do alert messages on the client side. But you can use javascript within the php to do the alert.

Code:
<script type="text/javascript">
window.alert("You message goes here!")
</script>
Reply With Quote
  #3 (permalink)  
Old 06-10-08, 10:55 AM
Fahad_1 Fahad_1 is offline
Newbie Coder
 
Join Date: Oct 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
you cant have alert boxes in server side scripting. you have to use javascript in that case.

i am not sure if you are talking about 'flash pages' like mozilla addons website.
__________________
Fahad
http://www.frinity.com - a blog from a web addict
Reply With Quote
  #4 (permalink)  
Old 06-10-08, 10:57 AM
Fahad_1 Fahad_1 is offline
Newbie Coder
 
Join Date: Oct 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
i dont think my term was correct.
flash page = pages showing you a custom message for 3-5 seconds and then redirecting you to another page.
__________________
Fahad
http://www.frinity.com - a blog from a web addict
Reply With Quote
  #5 (permalink)  
Old 06-11-08, 12:05 AM
coolsaggu's Avatar
coolsaggu coolsaggu is offline
Newbie Coder
 
Join Date: Jun 2008
Location: New Delhi, INDIA
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
as bizzar528 and Fahad_1 told you "PHP is a server side language, it can't do alert messages"

You can use the below code to generate a alert message


PHP Code:

if($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg'
{
    echo 
"<script type="text/javascript">window.alert("Sorrywe only allow uploading GIF images")</script>";
    exit;

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] General box positioning questions Shelby HTML/XHTML/XML 21 05-18-08 06:35 AM
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP upload script alej469 Job Offers & Assistance 5 05-18-06 05:01 AM
Php Mysql Bug??? tranquilraven PHP 4 03-01-06 03:06 AM
how to solve this PHP error? j14nhAo PHP 1 02-16-06 07:48 AM


All times are GMT -5. The time now is 07:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.