General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 29th, 2003, 09:51 PM
cinq cinq is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 1 cinq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Go to another url after mail()

Hi

I am a real beginner to php, only installed scripts so far. I have made a very simple mail script that uses the standard mail() function to email form input to my email address (for feedback at my site), I would like to know what to add after that so that the user upon posting will go back to the index page.

Right now, I just have it echoing to the screen Email Sent.

Thanks in advance,
Cindy

Reply With Quote
  #2  
Old July 30th, 2003, 01:54 AM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 7
Ok - asign a scalar to the mail() funtion and use a if to check if there were errors or not - the function returns false on error, so you would write it like so:
PHP Code:
 $result = @mail'blah''blah''blah' );
/*------------------------------------------------
Redirect on true, spawn error on false
------------------------------------------------*/
if ( $result )
{
        
header'location: page.php' );
        exit();
}
else
{
        echo( 
'Mail Failed' );



Also, you can shorten the above with a little advanced method, like so:
PHP Code:
 $result = @mail'blah''blah''blah' );
/*------------------------------------------------
Redirect on true, spawn error on false
------------------------------------------------*/
$result header'location: index.php' ) : exit( 'Failed' ); 
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #3  
Old July 30th, 2003, 03:02 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Quote:
$result = @mail( 'blah', 'blah', 'blah' );
/*------------------------------------------------
Redirect on true, spawn error on false
------------------------------------------------*/
$result ? header( 'location: index.php' ) : exit( 'Failed' );

It would probably be best to have the last line read
PHP Code:
 $result ? exit( header'location: index.php' ) ) : exit( 'Failed' ); 
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Go to another url after mail()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT