Jump to content

Recommended Posts

Im trying to have my page go to another URL after my form has been sent but dont understand what Im doing wrong!
I can get the alert message after the completion of the form but not the forward to the new html page.

Here is the top of my script where Im haing a problem:

[code]
<?
session_start();
include_once("admin/inc.php");
include_once("header_inc.php");
if ($_POST['action'] == "go") {
session_save_path("/home/users/web/b620/pow.mysite/classifieds/");
  $name = $_POST['name'];
  $email = $_POST['email'];
  $content = $_POST['content'];
  $IP = $_SERVER['REMOTE_ADDR'];
  if (!preg_match("(^[-\w\.]+@([-a-z0-9]+\.)+[a-z]{2,4}$)i", $email)) $alert = "You have entered an invalid email address.";
  if ($name == "" OR $email == "" OR $content == "") $alert = "To send a message, please complete all 3 fields.";
  if ($_SESSION['mail_count'] >= "3") $alert = "Only 3 messages can be sent per session.";
  if (!$alert) {
    if (!isset($_SESSION['mail_count'])) $_SESSION['mail_count'] = 0;
    $_SESSION['mail_count']++;
    $message .= "Name as follows:\n\n";
    $message .= "$name\n\n";
    $message .= "Email address as follows:\n\n";
    $message .= "$email\n\n";
    $message .= "Message as follows:\n\n";
    $message .= "$content\n\n";
    $message .= "IP address is: $IP\n\n";
    mail("john@mysite.com", "Mysite.com Message" , "$message", "From: Mysite Message Center <>");
    $name = "";
    $email = "";
    $content = "";
    $alert = "Your message has been sent.";
header("Location: commentsent.htm");
  }
}
?>
[/code]

It should forward  to the "commentsent.htm" page after the form is successfully sent.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.