|
Posted by Justin on 07/24/05 03:58
Previously, Trypt bashed *something* on the keyboard to form:
> Hi, I made a bunch of forms in dreamweaver, and created a basic php
> script to process the form and email me the results. So far so good,
> here is the script:
>
> <?
> $Name=$_POST['Name'];
> $Email=$_POST['Email'];
> $Comments=$_POST['Message'];
> $to="contact@webhost.com";
> $message="$Name just filled in your contact form. Message
> was:\n$Message\n\nTheir E-Mail address was: $Email";
> if(mail($to,"Comments From Your Site",$message,"From: $Email\n")) {
> echo "Your message was delivered successfully. Please use the back
> button of your browser to return to Webhost.";
> } else {
> echo "There was a problem sending the mail. Please check that you filled
> in the form correctly.";
> }
> ?>
>
> It works fine, it send a message to my email (i changed the email in the
> script, the one thats showing is just a generic email).
>
> However, I don't like the fact that when the submit button is pushed,
> and the form is executed successfully, the only thing it does is take
> the user to a blank white page with the echo message above:
>
> "Your message was delivered successfully. Please use the back button of
> your browser to return to Webhost."
>
> I really don't want the user to have to push the back button, and on top
> of that to be taken back to the same form page which is all filled in.
>
> Here is what I would like to add to this script if it is possible:
>
> A. Instead of the echo message above, just something simple like:
> "Click <here> to return to "webhost"", where <here> is a link of my
> choosing.
>
> but even better would be
>
> B. A redirection to a html page. For example, when the user completes
> the form, I'd like them to be taken to a success.html page if
> successful, or error.html if not.
>
> Is there anyway to do this simply in the same above script to replace
> the echo messages? Option B is what I really want, although I'll settle
> for A if the above requires advanced programming.
>
> Thank you very much.
Call your send message script from inside how your site is layed out ...
<?php include "inc/header0_l0.php"; ?>
<?php include "inc/header1_l0.php"; ?>
<?PHP include "*send mail form script*"; ?>
<?php include "inc/footer0_l0.php"; ?>
and set the form action to this new page ...
if you dont use includes to call the headers and such put
<normal bollox>
<body>
<?PHP include "*send mail form script*"; ?>
</body>
</html>
--
..:*Justin*:. http://www.wired2blow.me.uk
Locked my coathanger in my car...good thing I had my key!
[Back to original message]
|