Al John
Al John

Reputation: 900

PHP does not redirect to contact HTML page?

This is my first time trying to write PHP. Sending the form input to my e-mail address works fine but after submitting the form it does not redirect to the contact.htm page! Why not?

<?php
  $name = $_REQUEST['textfield'];
  $email = $_REQUEST['email'];
  $message = $_REQUEST['textarea'];
  $mailto = "[email protected]";
  $from = "Sent by: ". $email. " ". $name . "\r\n";

  mail($mailto,"Contact form",$message,$from);
  include '/sub/folder/contact.htm';
?>

The contact.htm page is in the /sub/folder/ and the same path is used in the PHP code above. Have I missed something? Can't I use subfolders? Does the file have to be in the site root main directory?

Upvotes: 1

Views: 42

Answers (2)

Hitesh Kumar
Hitesh Kumar

Reputation: 373

Use header function instead of include -

header("Location: /sub/folder/contact.htm");

Upvotes: 0

Ehsan feyzolahi
Ehsan feyzolahi

Reputation: 124

include is not working here. try this sample:

header("Location: http://YOUR_ADDRESS_HERE");

the address depends on your webService. localhost following any ports you've set

Upvotes: 1

Related Questions