Envoie de données [PHP / MySQL]
Bonjour,
Je pratique le lien PHP / MySQL depuis peu de temps, alors merci d'excusez mon ignorance :)
Alors l'erreur qui m'est renvoyée est :
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\TerreAgir_MLaVie\Pages\chequeParticulier_form.php on line 36
Je pense que cela pourrait peut-être venir de ma requête SQL où le champs ID_CHEQUE est en auto-increment. Mais bon je me trompe peut-être.
Je vous livre mon code PHP :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
$bdd = new PDO('mysql:host=localhost;dbname=terreagir-mlavie', 'root', '', $pdo_options);
$nom = $_POST['nom'];
$rue = $_POST['rue'];
$ville = $_POST['ville'];
$cp = $_POST['cp'];
$tel = $_POST['tel'];
$email = $_POST['email'];
if(empty($email))
{
echo '<font color="red"><b>Veuillez entrer votre adresse e-mail dans le champ indiqué</b></font>';
}
else
{
$point = strpos($email,".");
$arob = strpos($email,"@");
if($point=='')
{
echo 'Votre adresse doit comporter un <b>point</b>';
}
else if($arob=='')
{
echo 'Votre adresse doit comporter un <b>@</b>';
}
}
// Insertion du client à l'aide d'une requête préparée
$req = $bdd->prepare('INSERT INTO t_chequesparticulier ( ID_CHEQUE, NOM , NUM_RUE, VILLE, CP, TEL_FIXE, EMAIL) VALUES('', '$nom', '$rue', '$ville', '$cp', '$tel', '$email')');
//$req->execute(array($nom, $rue, $ville, $cp, $tel, $email));
mysql_query($reqsql,$bdd);
// Redirection du visiteur vers une page correspondant à son pays
if ($_POST['pays'] == '1')
{
header('Location: paiementChequeFrance.php');
}
if ($_POST['pays'] == '2')
{
header('Location: paiementChequeSuisseBelgLux.php');
}
if ($_POST['pays'] == '3')
{
header('Location: paiementChequeHorsEurope.php');
}
if ($_POST['pays'] == '4')
{
header('Location: paiementChequeDomTom.php');
} |
Et le formulaire HTML correspondant est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<form name ="infoParticulier" id ="infoParticulier" method="POST" action="chequeParticulier_form.php" onsubmit="return champsok()">
<p style=" text-align: left;">
<label for="nom"><span style="color: red;">*</span>Nom :</label> <input style="width: 400px; margin-left: 0%;" type="text" name="nom" id="nom" /><br/>
<label for="rue"><span style="color: red;">*</span>N° et rue :</label> <input style="width: 400px; margin-left: 8%;" type="text" name="rue" id="rue" /><br />
<label for="ville"><span style="color: red;">*</span>Ville :</label> <input style="width: 400px; margin-left: 11.75%;" type="text" name="ville" id="ville" /><br />
<label for="cp"><span style="color: red;">*</span>Code postal :</label> <input style="width: 400px; margin-left: 6.5%;" type="text" name="cp" id="cp" /><br />
<label for="pays"><span style="color: red;">*</span>Pays :</label><SELECT style="margin-left: 12.25%;" name="pays" size="1">
<OPTION value="1" selected>France</option>
<OPTION value="2">Suisse, Belgique ou Luxembourg</option>
<OPTION value="3">Hors Europe, Canada, Monaco, Andorre</option>
<OPTION value="4">DOM - TOM</option>
</SELECT><br/>
<label for="tel">Tel fixe :</label> <input style="width: 400px; margin-left: 9%;" type="text" name="tel" id="tel" /><br />
<label for="email"><span style="color: red;">*</span>Email :</label> <input style="width: 400px; margin-left: 11.25%;" type="text" name="email" id="email" /><br />
<input type="hidden" name="flag" value="1">
<label for="moyenPaiement">Votre moyen de paiement : </label>
<input type="radio" name="cheque" id="cheque" value="cheque" checked="checked" /><span style="font-size: 13px;">Chèque</span>
<input type="radio" name="virementBancaire" id="virementBancaire" value="virementBancaire" /><span style="font-size: 13px;">Virement bancaire (même sans carte bancaire)</span>
<input type="radio" name="paypal" id="paypal" value="paypal" /><span style="font-size: 13px;">Paiement <img src="../Images/logoPaypal.jpg" /> (même sans compte Paypal)</span><br/>
<input style="margin-left: 30%;" type="radio" name="virementAdmin" id="virementAdmin" value="virementAdmin" /><span style="font-size: 13px;">Virement administration (structure ou établissement scolaire français)</span>
<br/><br/>
<input style="margin-left: 25%;" type="submit" value="Suite de votre commande" />
</p>
<p style="color: red; font-size: 12px;">* champs obligatoires. Attention la facture sera envoyée à la même adresse que les outils.</p>
</form> |
Je précise que la ligne concernée par l'erreur est :
Code:
$req = $bdd->prepare('INSERT INTO t_chequesparticulier ( ID_CHEQUE, NOM , NUM_RUE, VILLE, CP, TEL_FIXE, EMAIL) VALUES('', '$nom', '$rue', '$ville', '$cp', '$tel', '$email')');
Car j'ai arrangé un peu le code dans mon post, donc ca ne correspondait pas.
Je vous remercie de votre patience et de vos futures réponses.