Hi i have created a form, with the submit button, which is working ok, but everytime the form is submitted, the page remains the same. I would like that as soon as the form is submitted, the system take the user to a thankyou page.

Can anyone help please

this is my code

<?  

$adminaddress = "dragon@dragon64.net, alicia.said87@gmail.com"; 
$sitename = "P"; 


// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

$nationality = $_POST['nationality'] ;
$age = $_POST['age'] ;
$year = $_POST['year'] ;
$loggeddives = $_POST['logged'] ;
$photographer = $_POST['photo'] ;
$cirk = $_POST['cirk'] ;
$write = $_POST['write'] ;
$scale = $_POST['scale'] ;
$scale1	= $_POST['scale1'] ;
$scale2 = $_POST['scale2'] ;
$scale3 = $_POST['scale3'] ;
$choice = $_POST['choice'] ;
$illegal = $_POST['illegal'] ;
$witness = $_POST['witness'] ;
$enforce = $_POST['enforce'] ;
$protect = $_POST['protect'] ;
$protect1 = $_POST['protect1'] ;
$protect2 = $_POST['protect2'] ;
$protect3 = $_POST['protect3'] ;
$protect4 = $_POST['protect4'] ;
$protect5 = $_POST['protect5'] ;
$posidonia = $_POST['posidonia'] ;
$choice = $_POST['choice'] ;
$choice1 = $_POST['choice1'] ;
$choice2 = $_POST['choice2'] ;
$choice3 = $_POST['choice3'] ;
$pay = $_POST['pay'] ;
$much = $_POST['much'] ;
$chekbox = $_POST['checkbox'] ;
$checkbox2 = $_POST['checkbox2'] ;
$checkbox3 = $_POST['checkbox3'] ;
$checkbox4 = $_POST['checkbox4'] ;
$checkbox5 = $_POST['checkbox5'] ;
$checkbox6 = $_POST['checkbox6'] ;
$checkbox7 = $_POST['checkbox7'] ;
$checkbox8 = $_POST['checkbox8'] ;
$checkbox9 = $_POST['checkbox9'] ;
$checkbox10 = $_POST['checkbox10'] ;
$checkbox11 = $_POST['checkbox11'] ;
$checkbox12 = $_POST['checkbox12'] ;
$checkbox13 = $_POST['checkbox13'] ;
$checkbox14 = $_POST['checkbox14'] ;
$checkbox15 = $_POST['checkbox15'] ;
$checkbox16 = $_POST['checkbox16'] ;
$checkbox17 = $_POST['checkbox17'] ;

//if (empty($nationality)){
//			  header("Location: http://www.dragon64.net/thankyou.html");
//		  }

	mail ("$adminaddress","Here is a questionnaire that has been compiled  $nationality",

	" 	Declare Cirkewwa as a Marine Protected Area

In an endeavour to declare Cirkewwa as a marine protected area, we are carrying out a survey to put forward the voice of the divers. Kindly fill in this questionnaire to help us reach our aim of safeguarding the beautiful dive site of Cirkewwa.

Basic Information

	
	Nationality: 		$nationality   	
	Age: 	            $age
	Year Certified: 	$year
	Logged Dives:		$logged
	Are you an underwater photographer? $photo
	
	___________________________________________________________________________________________________________________________
	
	Diving at Cirkewwa
	
	1.	On a scatle of 1 to 10, how do you rate Malta as a diviang destination?  $destination
	
	2.	Have you ever dived at Cirkewwa? $cirk

		a.	If yes, have you noticed any differences at Cirkewwa since you started diving? What type of differences?
			$write

	3.	On a scale of 1 to 10 how would you rate the following features at Cirkewwa as a diving site?  
		Write a number from 1 -10 for the following:
		Water quality: $scale
		Benthic life (Algae, corals and species that are attached to the ground): $scale1
		Pelagic life (including both migratory and stationary fish): $scale2
		Underwater scenery: $scale3
	
	4.	Which of the following species have you encountered while diving at Cirkewwa? (Kindly underline your answer)
        Groupers $checkbox
        Barracuda $checkbox2
        Morays $checkbox3
        Sea horses $checkbox4
        Sting rays $checkbox5
        Sun fish $checkbox6
        Tuna $checkbox7
        Amber jacks $checkbox8
        Squid $checkbox9
        Cuttle fish $checkbox10
        Octopus $checkbox11
        Coral $checkbox12
        Nudibrach $checkbox13
        Slipper lobster $checkbox14
        Crayfish $checkbox15

	5.	Have you ever witnessed fishing illegalities at Cirkewwa? $illegal

		a. 	If yes, how many did you witness?
			Insert a number: $witness

	6.	Do you think that the enforcement of the Cirkewwa NO FISHING ZONE around the wrecks is effective? $enforce

______________________________________________________________

Marine Protected Areas

	7.	Do you know what a Marine Protected area is?  $protect
		(If no, go to question 10)

	8.	On a scale of 1 to 10 how important do you think Marine Protected areas are?  $protect1

	9.	Have you ever dived in a Marine Protected Area? $protect2

		a.  If yes, has diving in a Marine protected Area added value to your diving experience? $protect2

	10.	Would the existence of Marine protected Areas influence your choice of a diving destination? $protect3

	11.	Do you think that Cirkewwa deserves the status of a Marine Protected Area?  $protect4

	12.	Do you know what Posidonia oceanica is? $protect5

	13.	Are you aware that there are marine species that are protected in the Maltese waters? $choice

		a.	If yes, can you name three of these?
			1.	$choice1
			2.	$choice2
			3.	$choice3

	14.	Are you willing to pay a premium for environmental quality and good diving as one pays in order to enter a terrestrial park?
		$pay
		
		If yes, how much are you willing to pay?
		Euro: $much

	
	
	Logged Info :
	------------------------------
	Using: $HTTP_USER_AGENT
	Hostname: $ip
	IP address: $REMOTE_ADDR
	Date/Time:  $date","FROM:$email" );
//	header("Location: http://www.dragon64.net/thankyou.html") ;
	


		
	
//	mail ("$email","Dvd / Photos Order", 
//	"Hi $name,\n
	
//	attached please find a copy of your order form
		 
//	I would like to book a set of the Pembroke Athleta Football Nursery Celebrations, at the price of Lm3.00.

//	I would also like to order the following photos Photos 6x4   $small  at  25c
//	I would also like to order the following photos Photos 6 x 8 $medium at  85c 
//	I would also like to order the following photos Photos 8x10  $large	 at 150c 		 \n
	
//	Best Regards,
	
//	Administration Team
//	$sitename 
//	$siteaddress","FROM:$adminaddress") ; 


//	echo "Thank you for taking your time to order. Click here to return to www.pembrokeathletafn.com";
		

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Declare Cirkewwa as a Marine Protected Area</title>
<style type="text/css">
<!--
#form1 p {
	text-align: left;
	font-weight: bold;
	font-size: 18px;
}
#form1 a {
	text-align: left;
}
#form1 {
	text-align: left;
	font-size: 18px;
}
.a {
	font-weight: bold;
}
.aa {
	font-weight: bold;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <label><br />
  </label>
  <p>Declare Cirkewwa as a Marine Protected Area</p>
  <p><br />
    <span id="form1">In an endeavour to declare Cirkewwa as a marine  protected area, we are carrying out a survey to put forward the voice of the  divers. Kindly fill in this questionnaire to help us reach our aim of  safeguarding the beautiful dive site of Cirkewwa.</span></p>
  <p><br />
    <strong><u>Basic Information</u></strong></p>
  <label><br />
  <br />
    <span class="aa">Nationality</span>:
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="nationality" type="text" id="nationality" />
    <br />
    <br />
  </label>
  <label><span class="a">Age:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="age" type="text" id="age" />
  </label>
  <label for="write"></label>
  <p>
    <label>Year Certified :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="year" type="text" id="year" />
    </label>
  </p>
  <p>
    <label>Logged Dives:&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<input name="logged" type="text" id="logged" />
    </label>
  </p>
  <p>
    <label>Are you an under water Photographer?
      <select name="photo" id="photo">
        <option>Yes</option>
        <option>No</option>
      </select>
    </label>
  </p>
  <p>_____________________________________________________________________________________________________________</p>
  <p>Diving at Cirkewwa</p>
  <strong>
  <p>
  <label>1.	&nbsp;On a scale of 1 to 10, how do you rate Malta as a diving destination?&nbsp;
<select name="destination" id="destination">
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option>
  <option>5</option>
  <option>6</option>
  <option>7</option>
  <option>8</option>
  <option>9</option>
  <option>10</option>
</select>
    <br />
  </label>
  </p>
  <p>2.     <strong>&nbsp;Have you ever dived at Cirkewwa? </strong>
    <label>
      <select name="cirk" id="cirk">
        <option>yes</option>
        <option>no</option>
      </select>
    </label>
  </p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If yes, have you noticed any differences  at Cirkewwa since you started diving? What type of differences?</strong></p>
<p>
  <label>
    <textarea name="write" cols="150" rows="3" id="write"></textarea>
  </label>
</p>
<p>__________________________________________________________________________________________________________________________________________________________________________________________</p>
<p><strong>3. &nbsp;On a scale of 1 to 10 how would you rate the  following features at Cirkewwa as a diving site?</strong></p>
  <p><em> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choose a number from 1 -10 for the following</em>:<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Water  quality:
    <label>
      <select name="scale" id="scale">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
        <option>7</option>
        <option>8</option>
        <option>9</option>
        <option>10</option>
      </select>
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Benthic life  (Algae, corals and species that are attached to the ground): 
    <label>
      <select name="scale1" id="scale1">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
        <option>7</option>
        <option>8</option>
        <option>9</option>
        <option>10</option>
      </select>
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pelagic life  (including both migratory and stationary fish): 
    <label>
      <select name="scale2" id="scale2">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
        <option>7</option>
        <option>8</option>
        <option>9</option>
        <option>10</option>
      </select>
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Underwater  scenery:
    <label>
      <select name="scale3" id="scale3">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
        <option>7</option>
        <option>8</option>
        <option>9</option>
        <option>10</option>
      </select>
    </label>
  </p>
  <p>4.     <strong>&nbsp;Which  of the following species have you encountered while diving at Cirkewwa?</strong> (<em>Kindly  underline your answer)</em></p>
  <p>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Groupers
<input type="checkbox" name="checkbox" id="checkbox" />
<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Barracuda
<label>
      <input type="checkbox" name="checkbox2" id="checkbox2" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Morays 
    <label>
      <input type="checkbox" name="checkbox3" id="checkbox3" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sea horses 
    <label>
      <input type="checkbox" name="checkbox4" id="checkbox4" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sting rays 
    <label>
      <input type="checkbox" name="checkbox5" id="checkbox5" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sun fish 
    <label>
      <input type="checkbox" name="checkbox6" id="checkbox6" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tuna 
    <label>
      <input type="checkbox" name="checkbox7" id="checkbox7" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp; &nbsp;Amber jacks 
    <label>
      <input type="checkbox" name="checkbox8" id="checkbox8" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Squid 
    <label>
      <input type="checkbox" name="checkbox9" id="checkbox9" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cuttle fish 
    <label>
      <input type="checkbox" name="checkbox10" id="checkbox10" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Octopus 
    <label>
      <input type="checkbox" name="checkbox11" id="checkbox11" />
    </label>
    <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Coral
<label>
      <input type="checkbox" name="checkbox12" id="checkbox12" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nudibrach 
    <label>
      <input type="checkbox" name="checkbox13" id="checkbox13" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Slipper  lobster 
    <label>
      <input type="checkbox" name="checkbox14" id="checkbox14" />
    </label>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Crayfish 
    <label>
      <input type="checkbox" name="checkbox15" id="checkbox15" />
    </label>
  </p>
  <p>5.     <strong>&nbsp;Have you ever witnessed fishing  illegalities at Cirkewwa?</strong>
    <label>
      <select name="illegal" id="illegal">
        <option>yes</option>
        <option>no</option>
      </select>
    </label>
  </p>
  <p>	 &nbsp;&nbsp;&nbsp;&nbsp;<strong>&nbsp;a. If yes, how many did you witness?</strong>
    <label>
      <input name="witness" type="text" id="witness" size="4" />
    </label>
  </p>
  <p>6.     <strong>&nbsp;Do you think that the enforcement of the  Cirkewwa NO FISHING ZONE around the wrecks is effective?</strong>
    <label>
      <select name="enforce" id="enforce">
        <option>no</option>
        <option>yes</option>
</select>
    </label>
  </p>
  <p><br />
    ______________________________________________________________<br />
  </p>
  <p><strong><u>Marine Protected Areas</u></strong></p>
  <p><strong>7. &nbsp;Do you know what a Marine Protected area  is</strong>? 
    <label>
      <select name="protect" id="protect">
        <option>yes</option>
        <option>no</option>
      </select>
    </label>
  </p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(If no, go to question 10)</em></p>
<p><em>8. </em><strong>&nbsp;On a scale of 1 to 10 how important do you  think Marine Protected areas are?</strong>
  <label>
    <select name="protect1" id="protect1">
      <option>1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
      <option>6</option>
      <option>7</option>
      <option>8</option>
      <option>9</option>
      <option>10</option>
    </select>
  </label>
</p>
<p><strong>9. &nbsp;Have you ever dived in a Marine Protected  Area? </strong>
  <label>
    <select name="protect2" id="protect2">
      <option>yes</option>
      <option>no</option>
    </select>
  </label>
</p>
  <p>	&nbsp;&nbsp;&nbsp;&nbsp;<strong>&nbsp;a. &nbsp;If yes, has  diving in a Marine protected Area added value to your diving experience? </strong>
    <label>
      <select name="protect3" id="protect3">
        <option>yes</option>
        <option>no</option>
      </select>
    </label>
  </p>
  <p> 10. <strong>Would  the existence of Marine protected Areas influence your choice of a diving  destination? </strong>
    <label>
      <select name="protect4" id="protect4">
        <option>yes</option>
        <option>no</option>
      </select>
    </label>
  </p>
<p> <strong>11.&nbsp;Do  you think that Cirkewwa deserves the status of a Marine Protected Area?</strong>
  <label>
    <select name="protect5" id="protect5">
      <option>yes</option>
      <option>no</option>
    </select>
  </label>
</p>
<p>12. <strong>Do  you know what <em>Posidonia oceanica</em> is? </strong>
  <label>
    <select name="posidonia" id="posidonia">
      <option>yes</option>
      <option>no</option>
    </select>
  </label>
</p>
<p>13. <strong>Are  you aware that there are marine species that are protected in the Maltese  waters?</strong> 
  <label>
    <select name="choice" id="choice">
      <option>yes</option>
      <option>no</option>
    </select>
  </label>
</p>
<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If yes, can you name three of these?</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.
  <label>
    <input name="choice1" type="text" id="choice1" size="40" />
  </label>
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.
  <label>
    <input name="choice2" type="text" id="choice2" size="40" />
  </label>
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.
  <label>
    <input name="choice3" type="text" id="choice3" size="40" />
  </label>
</p>
<p>14.   <strong>Are  you willing to pay a premium for environmental quality and good diving as one  pays in order to enter a terrestrial park?
  <label>
    <select name="pay" id="pay">
      <option>yes</option>
      <option>no</option>
    </select>
  </label>
</strong></p>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    If yes, how much are you willing to pay? &nbsp;&nbsp;&euro; 
    <label>
      <input name="much" type="text" id="much" size="4" />
    </label>
    <br />
    <br />

  <hr />
  <p>&nbsp;</p>
  <p>
    <input type="submit" name="Submit" value="Submit" />
  
</form>
</body>
</html>
Member Avatar for diafol

Graphix - you're a glutton for punishment. I couldn't even bring myself to read past line 200!

You can redirect visitors after you processed the form (around line 175) using the Header() function:

header('Location: http://www.example.com/');

See the reference: http://php.net/manual/en/function.header.php

~G

I tried doing it like that but still i was getting errors what i have done now is split the php from the form. I.e. i have put the form in an html page, and the function in a php page, and it has worked ok.

thank you for your assistance

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.