Jump to content

noob needs help


dbooker24

Recommended Posts

I want to change my php form handler. Right now when someone hits submit it writes out a thank you using the code below:

 

$recipient="[email protected]";

      $subject="Registration Information";

      error_reporting(0);

      if (mail($recipient, $subject, $msg)){

        echo "<h1>Thank You</h1><p>Your form has been submitted!.:</p>\n";

        echo nl2br($input);

      } else

        echo "An error occurred and the message could not be sent.";

  } else

      echo "Bad request method";

 

 

Instead i would like it to just redirect them to another web page. How do I do this? Thanks for helping a noob to php.

Link to comment
https://forums.phpfreaks.com/topic/139043-noob-needs-help/
Share on other sites

$recipient="[email protected]";
      $subject="Registration Information";
      error_reporting(0);
      if (mail($recipient, $subject, $msg)){
         header("Location: somepage.php"); exit();
      } else
         echo "An error occurred and the message could not be sent.";
   } else
      echo "Bad request method";

 

Note: that will only work if there is no output before that header call.  If you have output before that header call, refer to the sticky about headers in this forum.

Link to comment
https://forums.phpfreaks.com/topic/139043-noob-needs-help/#findComment-727213
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.