I am trying something very basic as I am very new to Web Design.

When someone fills out a form and clicks submit, a default page letting the person know their submission was sent opens. For me, the data is then sent to my e-mail so I may read the persons question, request or whatever. What I am trying to do is once the person submits the form, I want the data to still go to my e-mail but instead of showing a default submission page I would like them to see a confirmation/submission web page I created. I am using Yahoo as my web host and it is their default submission page I see. Please help.

Dani AI

Generated

’s situation (Yahoo host + Dreamweaver form showing the host’s default “submitted” page) is common: the page the visitor sees after submit is whichever form processor handles the POST. is right that some host-supplied processors let a site owner specify a return URL, but hosts differ. Three practical, low-friction approaches follow.

A. Build a tiny server-side handler (cleanest control)
Create a simple script on the site that receives the POST, sends the email, then issues an HTTP redirect to the custom thank-you page. Example in PHP (sanitize inputs and remove CR/LF from header fields to prevent header-injection):

<?php
$to = 'owner@example.com';
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
$email = isset($_POST['email']) ? trim($_POST['email']) : '';
$message = isset($_POST['message']) ? trim($_POST['message']) : '';

$name  = str_replace(array("\r","\n"), '', $name);
$email = str_replace(array("\r","\n"), '', $email);

$body = "Name: $name\nEmail: $email\n\n$message\n";
$headers = "From: $name <$email>\r\nReply-To: $email\r\n";

mail($to, 'Contact form', $body, $headers);
header('Location: /thank-you.html');
exit;
?>

B. Hidden-iframe trick (no server scripting required)
Target the host mailer to a hidden iframe and redirect the main window once the iframe loads. This keeps the host’s default response out of sight but still lets the host process the form:

<form action="https://host/cgi-bin/formmailer" method="post" target="hidden_iframe">
  <!-- inputs -->
  <input type="submit" value="Send">
</form>

<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;"></iframe>

<script>
document.getElementById('hidden_iframe').addEventListener('load', function(){
  window.location.href = '/thank-you.html';
});
</script>

Notes and troubleshooting

  • If the host supports a return/redirect parameter, that’s the simplest — check hosting docs or support.
  • The iframe load will fire even if the response is on another domain, but some hosts send headers (X-Frame-Options) that prevent embedding.
  • Always validate/sanitize server-side (never trust client-side only).
  • Dreamweaver’s Server Behaviors can auto-generate handlers if the host supports PHP/ASP; otherwise the iframe method is the least-code workaround.

Recommended Answers

All 6 Replies

The cgi mail script usually provides an option for which page to send the user to upon completion of the form

The cgi mail script usually provides an option for which page to send the user to upon completion of the form

CGI mail script. Um, it seems I am in over my head. Could you elaborate a more please. So I can be clearer, I would like the information from the form sent to my e-mail, but I would like the user to see a "Thank you " web page after they press the submit button.

Yeah...that's what I said the first time I wanted to have form information sent back to me from a Web site.

I came across a script back then from a website called bignosebird.com.

You can check out the script for youself at

It's free and comes with instructions.

The link you provided is a great tool for those who know how to code. Sadly, I am not that person.

My webhost already provides the mail server people send the forms to. However, they only see a generic "form submitted" page after their submission and the submitted data goes to the e-mail address provided by my mail server. Instead of seeing that generic "form submitted" page I want them to see a thank you page I created. How do I do that?

Unfortunately, it is a part of your host's cgi mail program.

For instance, in the BNB program, you add the following lines to your form:

<input type="hidden" name="ok_url" value="">
<input type="hidden" name="not_ok_url" value="">

If they don't tell you how to override the default, you're probably out of luck.

It seems they aren't that savvy. The guy eluded to some sort of re-direction after a person submits the form. Is that possible and how do I do that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.