digi-mech
09-03-2009, 06:41 PM
Hi
new to coding, so bear with me.
I have built a simple form on my website. I have used php to validate and send the form via email, all works fine. but once the form is sent I need the user to be directed back to the home page.
is there a simple way to do this, all the code I can find is reliant on header and wont work as I already have text in the page. unless Im setting it up wrong, which is possible too.
thanks
mlseim
09-03-2009, 06:45 PM
Don't have any text on that page.
If you're going to redirect, what's the point?
Otherwise, use an HTML (meta tag) redirect after 5 seconds, or whatever.
Or, a link such as "Click here for main page".
I would just redirect to a thankyou page and not have any text on the email processor.
digi-mech
09-03-2009, 06:56 PM
Don't have any text on that page.
If you're going to redirect, what's the point?
Otherwise, use an HTML (meta tag) redirect after 5 seconds, or whatever.
Or, a link such as "Click here for main page".
I would just redirect to a thankyou page and not have any text on the email processor.
ok so I can put html on the php file? didnt realise that! easy then
digi-mech
09-03-2009, 07:03 PM
that didnt work for me.
the only text on the page is php code, I would like to redirect to the home page or a thankyou page.
[vengeance]
09-03-2009, 07:08 PM
You can write HTML on PHP pages. You could either end your PHP (?>) and write your HTML and then start PHP again (<?php) or you could write HTML directly in echo's.
echo "<b>HTML here</b><br />";
echo "<a href=\"http://www.google.com\">Google!</a>"; // You have to escape the double quotes, though, by adding a back slash.
And if you want to redirect the user to another page, you can use META tags or the header(); function.
header("Location: thankyou.html");
You might want to add ob_start(); at the top too, that way it worked for me.
digi-mech
09-03-2009, 08:18 PM
vengence... many thanks ,thats sorted it for me ;)
steve
[vengeance]
09-03-2009, 10:34 PM
vengence... many thanks ,thats sorted it for me ;)
steve
You're welcome! Glad I could help.