Parse error dans script php

Résolu/Fermé
luna - 6 mars 2006 à 10:12
 Yo - 9 déc. 2009 à 22:45
Bonjour, je suis débutante en php et confrontée a ce pb:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\easyphp1-8\www\admin\essai2.php on line 89

voici mon code:

<?
// si les variables sont affectées
if (isset($_POST)) extract ($_POST);
?>

<html>

<head>

<body>

<h2> Etape 2: Générer les questions et les réponses </h2>
<!-- traiter si les variables sont vides ou non -->

<?
// on recupère le nom de l'entreprise
$nom=$_GET['nom'];
?>

<form method="post" action="essai3.php?nom=<? echo $nom; ?>">

Thème <? echo $_POST["theme1"]; ?> <p>

Question 1: <input type="text" name="question1"> <p>
Question 2: <input type="text" name="question2"> <p>
Question 3: <input type="text" name="question3"> <p>
Question 4: <input type="text" name="question4"> <p>
Question 5: <input type="text" name="question5"> <p>

Thème <? echo $_POST["theme2"]; ?> <p>

Question 1: <input type="text" name="question6"> <p>
Question 2: <input type="text" name="question7"> <p>
Question 3: <input type="text" name="question8"> <p>
Question 4: <input type="text" name="question9"> <p>
Question 5: <input type="text" name="question10"> <p>

Thème <? echo $_POST["theme3"]; ?> <p>

Question 1: <input type="text" name="question11"> <p>
Question 2: <input type="text" name="question12"> <p>
Question 3: <input type="text" name="question13"> <p>
Question 4: <input type="text" name="question14"> <p>
Question 5: <input type="text" name="question15"> <p>

Thème <? echo $_POST["theme4"]; ?> <p>

Question 1: <input type="text" name="question16"> <p>
Question 2: <input type="text" name="question17"> <p>
Question 3: <input type="text" name="question18"> <p>
Question 4: <input type="text" name="question19"> <p>
Question 5: <input type="text" name="question20"> <p>

Thème <? echo $_POST["theme5"]; ?> <p>

Question 1: <input type="text" name="question21"> <p>
Question 2: <input type="text" name="question22"> <p>
Question 3: <input type="text" name="question23"> <p>
Question 4: <input type="text" name="question24"> <p>
Question 5: <input type="text" name="question25"> <p>
<br>

<input type="submit" value="Valider"> <p>

</form>

</body>

</html>

<?
// en enregistre les thèmes dans la base de données

// on se connecte à MySQL
$connexion = mysql_connect('localhost', 'root', '');

// on sélectionne la base
mysql_select_db('mysql',$connexion);


// on fait une boucle pour chaque thème non vide
for ($i=0;$i<6;$i++)
{

if (!empty ($_POST["theme$i"]))
{
echo $_POST["theme$i"];
// on enregistre chaque thème donné dans la table "enquete"
$sql = "insert into enquete (id,nom_entreprise,thèmes,questions,reponses) values ('','$nom','$_POST["theme$i"]','','')";

// on transfère les requêtes au serveur
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());

}
}
?>

merci!
A voir également:

2 réponses

P@ Messages postés 1709 Date d'inscription vendredi 7 juillet 2000 Statut Membre Dernière intervention 24 mars 2009 185
6 mars 2006 à 11:17
c'est la quelle la 89 ??
5
cestadire.ch Messages postés 82 Date d'inscription mardi 29 novembre 2005 Statut Membre Dernière intervention 27 septembre 2006 31
6 mars 2006 à 11:15
à la ligne:

$sql = "insert into enquete (id,nom_entreprise,thèmes,questions,reponses) values ('','$nom','$_POST["theme$i"]','','')";


1. Tu ne peux pas utiliser les " dans $_POST[] car tu les utilises déjà pour délimiter le string. Essaye $_POST[\"theme$i\"]

2. Es-tu sûr qu'il y a un accent dans le nom du champ "thèmes" ?!
0
Mon problème à moi c'est ma requete qui ne passe pas nom plus :

mysql_query("INSERT INTO `customer data` (`Entreprise`, `Nom`, `Prénom`, `Adresse`, `Ville`, `Code Postal`, `Pays`, `telephone`, `site web`, `email`, `number of tags`, `login`, `password`) VALUES( 'htmlentities($_POST[\'Entreprise\'])', 'htmlentities($_POST[\'Nom\'])', 'htmlentities($_POST[\'Prénom\'])', 'htmlentities($_POST[\'Adresse\'])', 'htmlentities($_POST[\'Ville\'])','htmlentities($_POST[\'Code Postal\'])','htmlentities($_POST[\'Pays\'])','htmlentities($_POST[\'telephone\'])', 'htmlentities($_POST[\'site web\'])','htmlentities($_POST[\'email\'])','htmlentities($_POST[\'number of tags\'])', 'NULL', 'NULL')");

Si qqun peut m'aider
0