Problème Header location

Répondre
magouya
le 08/03/2010 à 19:27
magouya
Bonjour,

voici mon problème, j'ai créer un tout petit site (page unique) sur laquelle j'ai un formulaire en bas de page.

Lors de mes tests j'ai hebergé ce site chez mon hebergeur infomaniak, et je n'ai rencontré aucun soucis à l'envoie de mon formulaire, il est visible à cette adresse, vs pouvez faire des test;
http://www.magouya.com/CLIENT/DENTAL/index.php

Mais, depuis que j'ai balancé le site sur son hebergeur final Sivit, j'ai un problème de Header à l'envoi du formulaire, visible ici;
http://www.dental-tourism-caribbean.com/index.php

Je n'ai strictement rien changé à la structure du fichier :s
Et je n'arrive pas à corriger le problème par moi même :(

Voici le code de ma page:

<?php
// **************************************************************
// Created by Zero 3 Computers
// www.zero3computers.com
// If you like the contact form please support the creator by
// leaving this part in. We do not require it, but it would
// be really nice of you.
// Contact form with validation without using javascipt
// **************************************************************
// Get value from the form
if($_POST['submit']){
$lName=$_POST['lName'];
$fName=$_POST['fName'];
$email=$_POST['email'];
$adresse1=$_POST['adresse1'];
$adresse2=$_POST['adresse2'];
$zip=$_POST['zip'];
$town=$_POST['town'];
$country=$_POST['country'];
$tel=$_POST['tel'];
$fax=$_POST['fax'];

$title=$_POST['title'];

$message=$_POST['message'];
// Create a function that makes sure the email is a valide name@domain.com
function verify_email($email){
if(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/',$email)){
return false;
}else{
return $email;
}
}
// If email is in the correct format create a function that makes sure the domain behind the @ symbol exists
function verify_email_dns($email){
list($name, $domain) = split('@',$email);
if(!checkdnsrr($domain,'MX')){
return false;
}else{
return $email;
}
}
// If email domain is verified check to make sure all required fields are not empty, if they are redirect to with error message
if(verify_email($email)){
if(verify_email_dns($email)){
if ($fName==''){
header('location:index.php?error=missing#ancre');
}elseif ($lName==''){
header('location:index.php?error=missing#ancre');
}elseif ($email==''){
header('location:index.php?error=missing#ancre');
}elseif ($message==''){
header('location:index.php?error=missing#ancre');
}else{
// If everything is where it should be then get values and send in an email
foreach ($myvars as $var){
if (isset($_POST[$var])){
$$var=$_POST[$var];
}
}
// Value are explained below
$subject = "Contact from Dental Tourism"; // Subject of email sent to you
$add.="contact@magouya.com"; // Real email address to have the email sent to
$msg.="Last Name: \t$lName\n"; // Last Name
$msg.="First Name: \t$fName\n"; // First name (\t needs to line up with next line to have a straight email, \n is a <br>
$msg.="Email: \t$email\n"; // Email
$msg.="Adress 1: \t$adresse1\n"; // Adresse 1
$msg.="Adress 2: \t$adresse2\n"; // Adresse 2
$msg.="Zip Code: \t$zip\n"; // Zip code
$msg.="Town: \t$town\n"; // Town
$msg.="Country: \t$country\n"; // Country
$msg.="Tel: \t$tel\n"; // tel
$msg.="Fax: \t$fax\n"; // Fax

$msg.="Title: \t$title\n"; // Fax

$msg.="Message: \t$message\n"; // Message
$mailheaders="From: $email\n"; // Email that the visitor put in the email field. This will be the from email address
$mailheaders.="Reply-To: $email\n"; // Email that the visitor put in the email field. This will be the reply email address
mail("$add", "$subject", $msg, $mailheaders); // This part just adds the headers using the variables from above
header('location:index.php?error=none#ancre'); // Redirect using using none so they can see the email was a success
}
}else{
// If they fail the verify_email_dns function redirect to with error message
header('location:index.php?error=mx#ancre');
}
}else{
// If they fail the verify_email function redirect to with error message
header('location:index.php?error=format#ancre');
}
}
?>

<!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=UTF-8" />

<link rel="shortcut icon" href="favicon.ico" >


<title>Dental-tourism.com - Caribbean Smile Clinic in Sint-Maarten</title>



<!--
1 ) Reference to the files containing the JavaScript and CSS.
These files must be located on your server.
-->

<script type="text/javascript" src="java/highslide-with-html.js"></script>
<link rel="stylesheet" type="text/css" href="css/highslide.css" />


<!--
2) Optionally override the settings defined at the top
of the highslide.js file. The parameter hs.graphicsDir is important!
-->

<script type="text/javascript">
hs.graphicsDir = 'img/graphics/';
hs.outlineType = 'rounded-white';
</script>





<link href="css/main_style.css" rel="stylesheet" type="text/css" />
</head>

<body>

...


<div align="center">
<?php
$error=$_GET['error'];
switch ($error) {
case "mx":
echo "<br /><span class='red'>The domain name you entered for your email address does not exsit. Please try again.</span><br />";
break;
case "format":
echo "<br /><span class='red'>Your email address is not in the correct format, it should look like name@domain.com. Please try again.</span><br />";
break;
case "missing":
echo "<br /><span class='red'>You seem to be missing a required field, please try again.</span><br />";
break;
case "none":
echo "<br /><span class='green'>Your email was sent. We will reply within 24 hours. Thank you for your interest.</span><br />";
break;
default:
echo "<br />";
}
?>
</div>


...



</body>
</html>



Merci de votre aide :)
Magouya
LA GLOBULE
le 08/03/2010 à 23:51
LA GLOBULE
Je dois être bigleux, je ne vois aucune différence de comportement sur les 2 formulaires.

Quel est ton soucis en fait ? Tu nous dis que tu en as un, mais tu ne l'expliques pas :/
magouya
le 09/03/2010 à 12:49
magouya
Salut, tu as du passer juste après que j'ai corrigé mon problème ^^
j'ai simplement déplacé la ligne 81 à la 55..

Merci tout de même !
Magouya
Répondre

Ecrire un message

Votre message vient d'être créé avec succès.
LoadingChargement en cours