Jump to content

Redirecting a form back to the index page.


bella_3333

Recommended Posts

Hi

 

I have this php code so when you click submit it goes to a thank you page, but what i actually want is it to say thank you and go back to the index page automatically. Does anyone know how to do this. Here's the code

 

<?php

echo "

Thank you, $_POST[name], Your message has been sent.

";

//start building the mail string

$msg = "Name; $_POST[name]\n";

$msg .= "E-Mail: $_POST\n";

$msg .= "Message: $_POST\n";

$recipient = "kreativ108@gmail.com";

$subject = "comment form";

$mailheaders = "From: My Website \n";

$mailheaders .= "Reply-to: $_POST";

//send the mail

mail($recipient, $subject, $msg, $mailheaders);

?>

Link to comment
Share on other sites

in php you could use

$page = 'index.php';

$sec = "5"

header("Refresh: $sec; url=$page");

the above code would redirect you in 5 seconds.

 

Will this header function cause the new page to be refreshed every 5 seconds? If not, I like it.

Edited by dms
Link to comment
Share on other sites

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