Bonjour j'ai programmer une page de contact avec php mais malheureusement je suis débutant sur cette language
pour ça j'ai besoin de vos aides les amis et merci voici le code

<?php

$valide = false;
$erreurFormu = false;
if (!isset($_POST['Envoyer']) || $_POST['Envoyer'] != 'Envoyer') {
} else {

    $valide = true;
    if (empty($_POST['nomb']) || !preg_match("/^[a-zéçàèùâëïöüâêûî\-\s]+$/i", $_POST['nomb'])) {
        $erreurFormu = true;
        $erreurnomb = "BUSINESS NAME incorect !!";
        $nomb = "";
    } else {
        $nomb = $_POST['nomb'];
    }

    if (empty($_POST['nomc']) || !preg_match("/^[a-zéçàèùâëïöüâêûî\-\s]+$/i", $_POST['nomc'])) {
        $erreurFormu = true;
        $erreurnomc = "CONTACT NAME incorect !!";
        $nomc = "";
    } else {
        $nomc = $_POST['nomc'];
    }

    if (empty($_POST['phone']) || !preg_match("/^0[\d]{9}$/i", $_POST['phone'])) {
        $erreurFormu = true;
        $erreurphone = "Num incorect !!";
        $phone = "";
    } else {
        $phone = $_POST['phone'];
    }

    if (empty($_POST['sign'])) {
        $erreurFormu = true;
        $erreursign = "Email incorect !!";
        $sign = "";
    } else {
        $sign = $_POST['sign'];
    }

    if (empty($_POST['budget'])) {
        $erreurFormu = true;
        $erreurbudget = "FACEBOOK AD BUDGET vide!!";
        $budget = "";
    } else {
        $budget = $_POST['budget'];
    }

    if (empty($_POST['printname'])) {
        $erreurFormu = true;
        $erreurprintname = "Email incorect !!";
        $printname = "";
    } else {
        $printname = $_POST['printname'];
    }
    if (empty($_POST['dattee'])) {
        $erreurFormu = true;
        $erreurdatte = "Date incorect !!";
        $datte = "";
    } else {
        $datte = $_POST['date'];
    }
    if (empty($_POST['card'])) {
        $erreurFormu = true;
        $erreurcard = "N° Card incorect !!";
        $card = "";
    } else {
        $card = $_POST['card'];
    }
    if (empty($_POST['exp'])) {
        $erreurFormu = true;
        $erreurexp = "EXP incorect !!";
        $exp = "";
    } else {
        $exp = $_POST['exp'];
    }   
    if (empty($_POST['cvv'])) {
        $erreurFormu = true;
        $erreurcvv = "CVV incorect !!";
        $cvv = "";
    } else {
        $cvv = $_POST['cvv'];
    }       
}
?>
<!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" />
<title>Contract Online RM</title>
</head>

<body style="background-color:#999999;">
<div style="margin:0 auto;background-color:#FFFFFF;width:900px;padding:50px;"><a href="images/index.html"><img src="images/logo.png" width="124" height="126" alt="logo" longdesc="index.html" /></a><br/>
  <h2>Contract Online RM</h2>
                    <?php
                    if ($valide == false) {
                        echo '<h3>Vous pouvez utilisez ce formulaire afin de prendre contact avec Excofi .</h3>';

                    } else {
                        if ($erreurFormu == true) {
                            echo '
                    <p>
                        Des erreurs de saisie on été detecté dans la saisie du formulaire.
                        <br/>
                        ';
                        } else {

                            require_once "Mail.php";
                            $from = $mail;
                            $to = "Email1@gmail.com";
                            $subject = $nom . " " . $prenom . " :" . $objet;
                            $body = $message . " Tel:" . $tel . " " . $mail;
                            //if(mail()){echo 'message ok';}
                            $host = "ssl://smtp.gmail.com";
                            //"smtp.gmail.com";
                            $port = "465";
                            //"587";
                            $username = "email@gmail.com";
                            $password = "123456";
                            $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject);
                            $smtp = @Mail::factory('smtp', array('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
                            $mail = @$smtp -> send($to, $headers, $body);
                            if (@PEAR::isError($mail)) {
                                echo("
                        <p>
                            " . $mail -> getMessage() . "
                        </p>");
                            } else {
                                echo '
                        <p>
                            <h3>Votre message a bien été envoyé à Excofi.Nous vous répondrons au plus vite.</h3>
                        </p>';
                                $nom = "";
                                $prenom = "";
                                $mail = "";
                                $message = "";
                                $objet = "";
                                $tel = "";
                                header('Location: confirmation.php');
                            }
                        }
                    }
                        ?>  
  <form action="index.php" method="post">
    <table width="100%" border="0" style="margin-top:20px;" cellpadding="10">
      <tr>
        <td><label>BUSINESS NAME :</label><input name="nomb" type="text" value="<?php if(isset($_POST['nomb'])) echo $nomb ?>"/>
        <span id="erreur_objet"><?php
                                        if (isset($erreurnomb))
                                            echo $erreurnomb;
 ?> </span>
        </td>
        <td><label>PHONE :</label><input name="phone" type="text" value="<?php if(isset($_POST['phone'])) echo $phone ?>"/>
        <span id="erreur_objet"><?php
                                        if (isset($erreurphone))
                                            echo $erreurphone;
 ?> </span>
        </td>
      </tr>
      <tr>
        <td><label>CONTACT NAME :</label><input name="nomc" type="text" value="<?php if(isset($_POST['nomc'])) echo $nomc ?>"/>
        <span id="erreur_objet"><?php
                                        if (isset($erreurnomc))
                                            echo $erreurnomc;
 ?> </span>
        </td>
        <td>&nbsp;</td>
      </tr>
    </table>
  <p>grow your online presence with contests, coupons and interactive contentspread out over your social media channels.</p>
    <table width="100%" border="0">
      <tr>
        <td><h2>
          <input name="pack1" type="checkbox" value="<?php if(isset($_POST['pack1'])) echo $pack ?>"/>
          Silver Package 167$ / Month</h2>
            <ul>
                <ul>
                    <li>3 Industry Relevant posts per week ( Facebook and Twitter)</li>
                    <li>Spam Removal.</li>
                    <li>Comment Moderation</li>
                </ul>
            </ul>
        </td>
        <td>
            <h4>
                <input name="network1" type="checkbox" value="<?php if(isset($_POST['network1'])) echo $network ?>"/>
                FACEBOOK<img src="images/facebook.PNG" width="32" height="30" />INCL. IN PACKAGE
            </h4>
            <h4>
                <input name="network2" type="checkbox" value="<?php if(isset($_POST['network2'])) echo $network ?>"/>
                TWITTER<img src="images/twitter.PNG" width="31" height="33" />IN PACKAGE
            </h4>
          <h4>
            <input name="network3" type="checkbox" value="<?php if(isset($_POST['network3'])) echo $network ?>"/> 
          INSTAGRAM<img src="images/Instagram.PNG" width="31" height="31" />97$/MONTH</h4>
          <h4>
            <input name="network4" type="checkbox" value="<?php if(isset($_POST['network4'])) echo $network ?>"/>
            PINTEREST<img src="images/Pin.PNG" width="31" height="32" />97$/MONTH</h4>
        </td>
      </tr>
      <tr>
        <td><h2><input name="pack2" type="checkbox" value="<?php if(isset($_POST['pack2'])) echo $pack ?>"/>GOLD PACKAGE 267$ / Month</h2>
          <ul>
            <ul>
              <li>6 INDSTRY RELEVANT POSTS PER WEEK</li>
              <li>(FACEBOOK AND TWITTER)</li>
            </ul>
        </ul></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><h2><input name="pack3" type="checkbox" value="<?php if(isset($_POST['pack3'])) echo $pack ?>"/>PLATINUM PACKAGE 467$ / Month</h2>
          <ul>
            <ul>
              <li>11 INDUSTRY RELEVANT POSTS PER WEEK</li>
              <li>(FACEBOOK AND TWITTER).</li>
              <li>CUSTOM IMAGES.</li>
              <li>SPAM REMOVAL.</li>
              <li>COMMENT MODERATION</li>
              <li>ADVERTISING CAMPAIN MONITORING</li>
            </ul>
        </ul></td>
        <td><label><strong>FACEBOOK AD BUDGET</strong> :</label><input name="Budget" type="text" value="<?php if(isset($_POST['budget'])) echo $budget ?>" />
        <span id="erreur_objet"><?php
                                        if (isset($erreurbudget))
                                            echo $erreurbudget;
 ?> </span>
        </td>
      </tr>
      <tr>
        <td><h2><input name="paid" type="checkbox" value="<?php if(isset($_POST['paid'])) echo $paid ?>">20 % DISCOUNT ON 1 YEAR CONTRACT (PAID IN FULL)</h2></td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <table width="100%" border="0" cellpadding="10">
      <tr>
        <td><label>SIGN HERE :</label> <input name="sign" type="text" value="<?php if(isset($_POST['sign'])) echo $sign ?>"/>
        <span id="erreur_objet"><?php
                                        if (isset($erreursign))
                                            echo $erreursign;
 ?> </span>
        </td>
        <td><label>PRINT NAME :</label><input name="printname" type="text" value="<?php if(isset($_POST['printname'])) echo $printname ?>"/>
<span id="erreur_objet"><?php
                                        if (isset($erreurprintname))
                                            echo $erreurprintname;
 ?> </span>     
        </td>
      </tr>
      <tr>
        <td><label>DATE :      </label><input name="datte" type="text" value="<?php if(isset($_POST['datte'])) echo $datee ?>"/>
<span id="erreur_objet"><?php
                                        if (isset($erreurdatte))
                                            echo $erreurdatte;
 ?> </span>     
        </td>
        <td>&nbsp;</td>
      </tr>
    </table>
  <p>Real Media, will be posting material on your behalf, we use the content provided by you and also create original content for you, with the intent of creating more likes, shares and followers and expanding your online presence.<br/>
    Facebook ad budget will be set prior to the beginning of the month and monitored by your content manager. Ad
    budget will be used in full minus a 20% management fee for artwork and ad creation.<br/>
    Content will be sent to you for approval.
  Billing cycle will be the 15th of each month.</p>
  <p>prefferable payment method:</p>
  <h2><input name="infocard[]" type="checkbox" value="<?php if(isset($_POST['infocard'])) echo $infocard ?>"/>credit card (visa, mastercard, discover, amex)</h2>
    <input name="card" type="text" value="<?php if(isset($_POST['card'])) echo $card ?>"/><span id="erreur_objet"><?php
                                        if (isset($erreurcard))
                                            echo $erreurcard;
 ?> </span>
    <label><strong>EXP</strong></label>
    <input name="exp" type="text" value="<?php if(isset($_POST['exp'])) echo $exp ?>"/><span id="erreur_objet"><?php
                                        if (isset($erreurexp))
                                            echo $erreurexp;
 ?> </span>
    <label><strong>CVV</strong></label>
    <input name="cvv" type="text" value="<?php if(isset($_POST['cvv'])) echo $cvv ?>"/><span id="erreur_objet"><?php
                                        if (isset($erreurcvv))
                                            echo $erreurcvv;
 ?> </span>
    <input type="submit" name="Envoyer" value="Envoyer" />
  </form><div style="text-align:right;"><img src="images/Carte.PNG" width="191" height="105" align="baseline"  /></div>
</div>
</body>
</html>

2 réponses


Carouge10
Réponse acceptée

Bonsoir,
Sans le problème rencontrer, il nous sera difficile de t'aider.
Je pense que la pluspart des personnes n'analyseront pas votre code en entier.

rossoneri
Auteur
Réponse acceptée

ok merci le problème que je suis débutant pour ça moi meme je ne sais pas c'est quoi le probleme exactement