- This topic is empty.
-
AuthorPosts
-
May 9, 2009 at 5:07 am #24822AlCaponeParticipant
Hi, at the moment my form has a method of ‘post’ when the form is submited the url redirects to the action file of the form, is there a way to stpo this?
Many Thanks
ChrisMay 9, 2009 at 1:35 pm #57365TheDocMemberMake sure that once your mail goes through, you add a statement to redirect the page, something like this:
Code:$result = “../contact-success.php”;if(mail($to, $subject, $message, $headers))
{
header(“Location: ” . $result);
}May 9, 2009 at 3:50 pm #57371AshtonSandersParticipant"AlCapone" wrote:is there a way to stpo this?Stop What? What do you want to happen when they click submit? Nothing? They go to a different page?
I think TheDoc got what you were trying to say, and his code will redirect the visitor to any page after the mail is sent, but if not, you’ll need to clarify what you want to happen when they click submit
May 10, 2009 at 2:53 pm #57390AlCaponeParticipantO.k sorry for no being clear – Im using wordpress and in the sidebar.php file i have a small form that sends me an email – When the person clicks the submit button they are taken to the php file that send me the email – but i want them to stay on the page that they were on.
Will the code given to me by ‘TheDoc’ redirect the person back to the page they came from in wordpress, ie – the form will be on everypage on the site, not just one, so will the code return them to the page they were last on or one that i have to specify?Many THanks
ChrisMay 11, 2009 at 1:05 am #57399AshtonSandersParticipantHmmm…
It’s a mixed answer:
Yes, The code from the Doc will send them back to whatever link you specify. You may be able to us the $_SERVER variable for referrer to send them back to the page they were on. I do believe that that code will be as good as you can get from a forum.
Problem: It will look like they haven’t submitted the form; leading most people to fill in and submit the form again… ending in utter confusion.
The proper solution would use a Javascript Framework/Ajax to submit the form and display a thank you without refreshing the page… I don’t have an easy way to do that =/
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.