PHP fatal error virtual

Résolu/Fermé
karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 - 25 mai 2009 à 20:43
 3wlabs.fr - 31 janv. 2010 à 10:18
Bonjour,

j'ai un problème avec une fatal error Virtual
fatal error: call to undefinited function virtual() ...................; on line 1

Je suis debutant, il s'agit d'un formulaire d'inscription. que dois je faire ??
ci dessous le script, merci d'avance

<?php virtual('/Connections/webtransit.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form4")) {
$insertSQL = sprintf("INSERT INTO inscription (societe, siret, contact, tel, fax, email, souhait, moyen, type, commentaire) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['societe'], "text"),
GetSQLValueString($_POST['siret'], "int"),
GetSQLValueString($_POST['contact'], "text"),
GetSQLValueString($_POST['Tel'], "int"),
GetSQLValueString($_POST['fax'], "int"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['souhait'], "text"),
GetSQLValueString($_POST['moyen'], "text"),
GetSQLValueString($_POST['type'], "text"),
GetSQLValueString($_POST['Commentaire'], "text"));

mysql_select_db($database_webtransit, $webtransit);
$Result1 = mysql_query($insertSQL, $webtransit) or die(mysql_error());

$insertGoTo = "/Site/merci.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
A voir également:

5 réponses

karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 1
26 mai 2009 à 17:31
Personne ne peut m'aider?? je suis completement bloqué

Merci
0
karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 1
28 mai 2009 à 19:45
Bonjour

pouvez vous m'aider SVP, je bloque tout car j'arrive pas à résoudre ce probleme.

merci d'avance
0
wido22 Messages postés 19 Date d'inscription samedi 23 mai 2009 Statut Membre Dernière intervention 1 juin 2009 31
29 mai 2009 à 05:02
Tout est marquer dans l'erreur : fatal error: call to undefinited function virtual();

Et si tu n'arrive pas a ressoudre cela, j'en conclu que tu ne dois pas trop t'y connaitre en php...

Je t'invite donc a suivre ce tutos : https://openclassrooms.com/fr/courses/918836-concevez-votre-site-web-avec-php-et-mysql qui comporte une partie sur les formulaire en php.

Ainsi peut etre te rendras-tu compte qu'il n'est pas bon de faire du copier coller sans tenter de comprendre.
0
karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 1
25 août 2009 à 08:23
Bonjour et merci pour la réponse
Pour info, il est vrai que je suis novice en PHP mais je ne copie pas sans comprendre. Je travaille avec Dreamweaver CS4 et celui ci me mets la fonction virtual qui me shoot quand je le test en ligne.

Je n'arrive pas à comprendre et c'est pour cela que je demande l'avis de personne plus expérimentées ce qui est à la base le but d'un forum.

Le site du zéro, je le connais, et il m'a appris beaucoup de chose mais il ne répond pas à ma question qui est bien précise ici.

Merci pour votre aide
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 1
25 août 2009 à 21:52
j'ai fait un formulaire simple comme suit:

-----------------------------
<?php virtual('/Connections/webtransit.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO commerciaux (nom, prenom, email, tel) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['prenom'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['tel'], "int"));

mysql_select_db($database_webtransit, $webtransit);
$Result1 = mysql_query($insertSQL, $webtransit) or die(mysql_error());

$insertGoTo = "/mentions legales.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!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>Document sans titre</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p>nom
<input type="text" name="nom" id="nom" />
</p>
<p>prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p>tel
<input type="text" name="tel" id="tel" />
</p>
<p>email
<input type="text" name="email" id="email" />
</p>
<p>
<input type="submit" name="ok" id="ok" value="Envoyer" />
<input name="hiddenField" type="hidden" id="hiddenField" value="<?php echo $_GET['ID']; ?>" />
</p>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
========================================
mais j'ai ce message d'erreur
Fatal error: Call to undefined function: virtual() in /web/webtransit/www/inscription2.php on line 1

pouvez vous m'aider SVP, que dois je mettre à la lace de virtual???
www.web-transit.com
0
Bonjour,

Je sais que c'est un peu tard mais on sais jamais pour les autres !!!

La fonction virtual() est similaire à la fonction include() ou require().

Il n'est pas tés conseillé d'utiliser cette fonction dans un fichier php.

Plus d'infos sont disponibles à cette adresse.
http://www.manuelphp.com/php/function.virtual.php

Bonne lecture !
0