A little help?

by Nathan Hamm on 4/14/2005 · 1 comment

I’ve added the ability to email articles. The plugin is a little screwy though. Not only is the message awkwardly worded (I’ve fixed it up somewhat), but after the message is mailed, it takes users to an unformatted page. The code can be found here, and the offending chunk of it is, I think, this:

if($mail->Send()) {
get_header();
echo "

Article: $post_title Has Been Sent To $friendemail

";
get_sidebar();
get_footer();
exit();
} else {
get_header();
echo '

'.$mail->ErrorInfo.'

';
get_sidebar();
get_footer();
}

The div tags aren’t showing up but that makes it easier to find where I’m having the problem in the code.

I know it has to do with how it’s retrieving the header, sidebar, and footer. The deal is, I have no idea what I’m doing and usually am only able to figure this stuff out when I have something to go off of. The layout for the email form was screwy and I was able to fix it by making it look like my standard page layout.

Ideally, I’d like the thing to just redirect to the main page or back to the post after it sends the email. Surely one of you know how to do this or could at least point me in the right direction, right?

This post was written by...

– author of 2040 posts on Registan.net.

Nathan founded Registan.net in 2003. He was a Peace Corps Volunteer in Uzbekistan 2000-2001 and received his MA in Central Asian Studies from the University of Washington in 2007. Since 2007, he has worked full-time as an analyst, consulting with clients on Central Asian affairs, specializing in how socio-cultural factors shape risks and opportunities. Follow him on Twitter or drop him a line.

{ 1 comment }

Martey May 1, 2005 at 10:44 pm

Perhaps the PHP header function is what you are looking for? You can use the PHP statement header("Location: http://www.registan.net"); to redirect to the main page.

Reply

Previous post:

Next post: