Jump to content

i can't seem to get this page to redirect..


cascer1

Recommended Posts

hello,

 

so i have this contact page on my website, but i want people to actually know if the mail got sent or not, so i first have contact.php, which sends all the information to sendmail.php, which in turn tells redirect.php wether or not the mail was sent, and redirect.php then shows this information for the user to see, and has a 10 second timer before users get sent back..

 

here is the website: http://hcg.drokz.eu.clanservers.com/

 

all files are in the same folder

 

 

so here is my code: 

 

<?php $url1 = 'redirect.php?sent=sent'; $url2 = 'redirect.php?sent=fail'; $timeout = 0; ?>

<?php $to = "admin@hcg.drokz.eu.clanservers.com"; 
$name = $_REQUEST['name'] ;
$subjectm = $_REQUEST['subject'] ;
$subject = "contact form entry on the hcg website by $name with the subject $subjectm"; 
$email = $_REQUEST['email'] ; 
$message = $_REQUEST['message'] ; 
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ; ?>


<?php if($sent) {header('Refresh: ' . $timeout . ';url=' . $url1); ?>

<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url1); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url1); ?>";}, <?php echo($timeout * 1000); ?>);
</script>
<?php } ; ?>

<?php else {header('Refresh: ' . $timeout . ';url=' . $url2); ?>

<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url2); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url2); ?>";}, <?php echo($timeout * 1000); ?>);
</script> 
<?php } ; ?>
  

<a href='contact.php'> this page should redirect you, if nothing happens, click here! </a>

 

<?php 
$sent = $_GET['sent'] ;
?>

<?php $url = 'contact.php'; $timeout = 10; ?>

<?php header('Refresh: ' . $timeout . ';url=' . $url); ?>
<meta http-equiv="refresh" content="<?php echo($timeout) ?>;url=<?php echo($url); ?>">
<script type="text/javascript">
  setTimeout(function(){window.location.replace("<?php echo($url); ?>";}, <?php echo($timeout * 1000); ?>);
</script>

    <h1>
<?php
if($sent == sent) {echo "Success!" } ;
elseif($sent == fail) {echo "Failure!" } ;
?></h1>
    <?php
if($sent == sent) {echo "your email has been sent successfully and we will reply as soon as we can."} ;
elseif($sent == fail) {echo "we have encountered a problem while sending your email, please try again!"} ;
?>
<p>
<a href='contact.php'> this page will redirect you in 10 seconds, if nothing happens or you can't wait, click here! </a>

Link to comment
Share on other sites

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.