Jump to content

Recommended Posts

Posted
if ($result ==  0) { 
   // Redirect the user to the wherever.php page.
   // Start defining the URL.
   $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

   // Check for a trailing slash.
   if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
       $url = substr ($url, 0, -1); // Chop off the slash.
   }

   // Add the page.
   $url .= '/wherever.php';

   header("Location: $url");
   exit();

   } else { 
       // other stuff happens
   }

Posted


processing





include ("contact.html");

$name = $_REQUEST['yourname'];
$email = $_REQUEST['email'];


if ($name == "") {

echo "Sorry but you need to put your name in.";

   // Redirect the user to the wherever1.php page.
   // Start defining the URL.
   $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

   // Check for a trailing slash.
   if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
       $url = substr ($url, 0, -1); // Chop off the slash.
   }

   // Add the page.
   $url .= '/wherever1.php';

   header("Location: $url");
   exit();

}

elseif ($email == "") {

echo "Sorry but we need your email address to get back to you";

   // Redirect the user to the wherever2.php page.
   // Start defining the URL.
   $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

   // Check for a trailing slash.
   if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
       $url = substr ($url, 0, -1); // Chop off the slash.
   }

   // Add the page.
   $url .= '/wherever2.php';

   header("Location: $url");
   exit();

}

// do stuff here with the $name and $email variables

?>




Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...