-1

I have this contact form:

<form class="contactform" action="contact.php" method="post">
    <table>
        <tr><td>Name</td></tr>
        <tr><td><input type="text" name="name"></td></tr>
        <tr><td>Phonenumber(optional)</td></tr>
        <tr><td><input type="text" name="telephone"></td></tr>
        <tr><td>E-mail</td></tr>
        <tr><td><input type="text" name="email"></td></tr>
        <tr><td>Your question or comment</td></tr>
        <tr><td><textarea name="comment"></textarea></td></tr>
    </table>
    <input type='submit' name='sending' value='Submit'>
</form>

And when the user clicks submit, it goes to a php script which sends the contact form details to me, which happends at action="contact.php" But I would like a separated html page, a "thanks for you question" page. How would I execute 2 files, via action or otherwise.

Thanks.

Vasco
  • 191
  • 1
  • 2
  • 12

4 Answers4

0

When you've finished processing your form data in contact.php redirect to your thankyou page: header('Location: '.'thankyou.php');

user3065931
  • 531
  • 7
  • 20
0

Just use print("thanks for you question"); at the end of your contact.php after you have processed the data or before it, however you like. You cannot send this to 2 different pages/files.

Luchiro
  • 53
  • 5
  • The file where the .php is in, is really old. Back when website's where created via `tables, tr, td`. So the php breaks the file's images and positions. – Vasco Mar 05 '15 at 12:50
0

Once your contact form has done what it needs to do, have it redirect to a thankyou page.

contact.php

// Your stuff here
header("location: /thank-you.php"); // Assumes thank-you.php is in server root
exit();

thank-you.php

<html>
<body>
<h1>Thank you</h1>
<p>Stuff stuff stuff!</p>
</body>
</html>
CT14.IT
  • 1,635
  • 1
  • 15
  • 31
0

Add header("location:thankyou.html"); in your contact.php file after the processing of request is complete.

Jayendra
  • 350
  • 2
  • 9