WampServer

Apache, PHP, MySQL on Windows 

 
  • Accueil forum
  • Retour à WampServer
  • presentation
  • Download
  • Addons
  • Formations
  • Alter Way

 
Voir le sujet: Précédent•Suivant
Aller à : Liste des Forums•Liste des messages•Nouvelle discussion•Recherche•Connexion•Imprimer la vue
ERROR!
Envoyé par: amica (---.129-81-70.mc.videotron.ca)
Date: 21 November 2009 à 15:35

Bonjour!

J'ai développé sous MAC OS avec FLASH CS4 et MAMP une borne interactive (FLASH PROJECTOR), un script PHP (save.php) permet a l'utilisateur d'inscrire son nom et adresse de courriel lorsqu'il appuie sur le bouton envoyer un script php fait une sauvegarde sur le disque interne de l'ordinateur en format .TXT

Tout fonctionne bien sous MAC OS j'ai transféré le tout sur un PC avec WAMP serveur installer et j'ai une erreur qui se lit comme suit :

Notice: Undefined index: Name in C:\wamp\www\save.php on line 5

Notice: Undefined index: Email in C:\wamp\www\save.php on line 6

Voici mon script php : (Il y a beaucoup de lignes que j'ai déactivé avec //).


<?php
// If you are using an old version of php, remove the next set of lines.
// or use $HTTP_POST_VARS["..."] instead.
//$Submit = $_REQUEST["Submit"];
$Name = $_POST["Name"];
$Email = $_POST["Email"];
//$Website = $_POST["Website"];
//$Comments = $_POST["Comments"];
//$NumLow = $_REQUEST["NumLow"];
//$NumHigh = $_REQUEST["NumHigh"];

// Replace special characters - you can remove the next 5 lines if wanted.
//$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
//$Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
//$Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
//$Website = eregi_replace("["];, "", $Website);
//$Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

// Remove slashes.
$Name = stripslashes($Name);
$Email = stripslashes($Email);
//$Website = stripslashes($Website);
//$Comments = stripslashes($Comments);

// ###################################################################################
// ########## Reading and Writing the new data to the GuestBook Database #############

//if ($Submit == "Yes"winking smiley
//if(isset($Name) and isset($Email))

{
// Next line tells the script which Text file to open.
$filename = "save.txt";

// Opens up the file declared above for reading

$fp = fopen( $filename,"r"winking smiley;
$OldData = fread($fp, 80000);
fclose( $fp );

// Gets the current Date of when the entry was submitted
$Today = (date ("l dS of F Y ( h:i:s A )",time()));

// Puts the recently added data into html format that can be read into the Flash Movie.
// You can change this up and add additional html formating to this area. For a complete listing of all html tags
// you can use in flash - visit: [www.macromedia.com]

// $Input = "Name: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></u></b><br>Date: $Today</font><br><br>.:::.";

$Input = "\n Name: $Name \n Email: $Email \n Date: $Today \n.:::.";

/* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file. This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file */

$New = "$Input$OldData";

// Opens and writes the file.

$fp = fopen( $filename,"w"winking smiley;
if(!$fp) die("&save=cannot write $filename ......&"winking smiley;
fwrite($fp, $New, 800000);
fclose( $fp );
}


?>




Merci! à l'avance de vos précieux conseils.

André Michaud
Québec, Canada

Options: Répondre•Citer ce Message
Re: ERROR!
Envoyé par: Otomatic (---.fbx.proxad.net)
Date: 21 November 2009 à 19:52

Bonsoir,

> Notice: Undefined index: Name in C:\wamp\www\save.php on line 5

$_POST["Name"] n'existe pas. Soit le nom dans le formulaire n'est pas "Name" (Attention à la casse des caractères), soit le formulaire n'a rien envoyé en méthode POST.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: Répondre•Citer ce Message


Aller à : Liste des Forums•Liste des messages•Recherche•Connexion
Désolé, seuls les utilisateurs connectés peuvent envoyer des messages dans ce forum.
Cliquer ici pour se connecter

design by jidePowered by Alter Way get firefoxget PHP