Auto redirecting after email form...

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

gray
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Nov 12, 2002 6:09 am
Location: UK
Contact:

Auto redirecting after email form...

Postby gray » Tue Nov 12, 2002 6:21 am

Hi, pretty new to PHP, but lovin it!

I have a PHP mail form, which gets input from the user and sends a mail from the site, then on submit it takes the user to mail.php which just says "Thanks for your feedback" - is there a script I can add to mail.php to give this message, then auto forward the user to somewhere?

Many thanks

-Gray

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Tue Nov 12, 2002 2:22 pm

I think JavaScript will be more batter for this action...

Code: Select all

<script language="JavaScript"><!--
t=1; function dorefresh() { u=new String(" [b]URL here[/b]  ");
ti=setTimeout("dorefresh();",1000); if (t>0) { t-=1; }
else { clearTimeout(ti); window.location=u.replace("#","&t="+parseInt(10000*Math.random())+"#"); }
} window.onLoad=dorefresh();
//--></script>


if browser does not support javascript use html - code

Code: Select all

<meta http-equiv="Refresh" content="1; URL="[b]URL here[/b]">

gray
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Nov 12, 2002 6:09 am
Location: UK
Contact:

Postby gray » Tue Nov 12, 2002 5:01 pm

Thanks man, appreciate that one ;)

I'll try it out :)

Thanks again

-Gray

User avatar
webwired
New php-forum User
New php-forum User
Posts: 26
Joined: Sat Nov 23, 2002 5:20 pm
Location: St. Louis, Missouri
Contact:

Postby webwired » Sat Dec 07, 2002 9:35 am

Here you go Elbonito...

Code: Select all

<?php
if(!$submit)
{
?>


<form action="<?php $PHP_SELF ?>" method="post">
<table width="500" bordercolor="#000000" cellspacing="0" cellpadding="2" border="0">
  <tr>
    <td colspan="2">
<br>
<b><center>Send me an email</center></b>
<br>
   </td>
  </tr>
  <tr>
    <td>&nbsp;Name</td>
    <td>
<input type="text" name="name" size="34">
    </td>
  </tr>
  <tr>
    <td>&nbsp;Email Address</td>
    <td>
<input type="text" name="email" size="34">
    </td>
  </tr>
  <tr>
    <td>&nbsp;Subject</td>
    <td>
<input type="text" name="subject" size="34">
    </td>
  </tr>
  <tr>
    <td>&nbsp;Comments</td>
    <td>
<textarea name="comments" rows="10" cols="25"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan=2>
<center>
<input type="submit" name="submit" value="Submit">
</center>
    </td>
  </tr>
</table>
</form>

<?php
}else{
?>

<?php
print "Thanks for sending me an email.";

$myname = "$name";
$myemail = "$email";

$contactname = "A man with too much money"; //put your name here
$contactemail = "billgates@msn.com"; //put your email address here

$message = "$comments";
$subject = "$subject";

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";

mail($contactemail, $subject, $message, $headers);
?>


<?php
}
?>


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], landi and 1 guest

cron