Bonjour,
J'ai un formulaire dans une pageA (Code ci-dessous) qui met à jour une base mysql et je voudrais qu'il déclenche une pageB qui contient un formulaire qui complète la mise à jour de la base mysql. Je ne sais pas modifier étant trés débutant. Je suppose que le meilleur serait de ne faire qu'un seul formulaire, mais c'est bien trop compliqué pour moi.
Je ne vois que la solution de passer d'un formulaire à l'autre, mais comment faire ?
Voici la page 1er formulaire (inscription.php) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php require_once('Connections/connexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
	function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
	{
		$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;
	}
}
 
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
  $MM_dupKeyRedirect="erreurinscription.php";
  $loginUsername = $_POST['email'];
  $LoginRS__query = sprintf("SELECT email FROM an_membre WHERE email=%s", GetSQLValueString($loginUsername, "text"));
  mysql_select_db($database_connexion, $connexion);
  $LoginRS=mysql_query($LoginRS__query, $connexion) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
 
  //if there is a row in the database, the username was found - can not add the requested username
  if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}
 
$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 an_membre (idmembre, email, pseudo, passe, datem, statut) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['idmembre'], "int"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['pseudo'], "text"),
                       GetSQLValueString($_POST['passe'], "text"),
                       GetSQLValueString($_POST['datem'], "text"),
                       GetSQLValueString($_POST['statut'], "text"));
 
	header("Location: membre/fichemembre.php");
	exit();
 
 
 mysql_select_db($database_connexion, $connexion);
  $Result1 = mysql_query($insertSQL, $connexion) or die(mysql_error());
 
  $insertGoTo = "envoimail.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
 
if(isset($_POST['email'])){$email=$_POST['email'];}
 
mysql_select_db($database_connexion, $connexion);
$query_Recordset1 = "SELECT validm FROM an_config";
$Recordset1 = mysql_query($query_Recordset1, $connexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);  
$datem = date("d/m/Y");
 
if($row_Recordset1['validm']!="y")
{
$statut='membre';
}
else
{
$statut='no_membre';
}
 
$query_Recordset1 = "SELECT validm FROM an_config";
$Recordset1 = mysql_query($query_Recordset1, $connexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
?>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' n est pas valide.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' est obligatoire\n'; }
  } if (errors) alert('   ATTENTION !\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<link href="feuille.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style1 {color: #666666}
body {
	margin-top: 2px;
}
-->
</style>
</head>
<body>
<div align="center"> 
  <table width="100%"  border="0">
    <tr>
      <td><div align="center"><p><span class="Style1"><br>
          </span><span class="sidebarHeader Style1">INSCRIPTION</span><br>
          <br>
          Tous les champs marqu&eacute;s d'un (<font color="#FF0000">*</font>) sont obligatoires <br>
            <br>
        </p></div><div align="center"> 
          <table width="285" border="1" >
            <tr>
              <td width="275" height="134" align="center">
                <form action="<?php echo $editFormAction; ?>" method="POST" name="form1">
									<table align="center">
                    <tr valign="baseline">
                      <td width="54" align="right" nowrap><div align="right">Email <font color="#FF0000">*</font>:</div></td><td width="197"><input type="text" name="email" value="" size="32"></td></tr>
                    <tr valign="baseline">
                      <td nowrap align="right"><div align="right">Pseudo <font color="#FF0000">*</font>:</div></td><td><input type="text" name="pseudo" value="" size="32"></td></tr>
                    <tr valign="baseline">
                      <td nowrap align="right"><div align="right">Passe <font color="#FF0000">*</font>:</div></td><td><input type="password" name="passe" value="" size="32"></td></tr>
                    <tr valign="baseline">
                      <td nowrap align="right">&nbsp;</td><td><input type="submit" onClick="MM_validateForm('email','','RisEmail','pseudo','','R','passe','','R');return document.MM_returnValue" value="Vérification"></td></tr>
                  </table><input type="hidden" name="idmembre" value="">
													<input type="hidden" name="datem" value="<? echo $datem ?>">
													<input name="statut" type="hidden" id="statut" value="<? echo $statut ?>">
													<input type="hidden" name="MM_insert" value="form1">
									</form></td></tr>
          </table><br>
 <?php 
 if($row_Recordset1['validm']=="y") {
	 print"<center>Petit rappel le webmaster valide toutes les inscriptions !</center>";
 }
  ?>
		</div></td></tr>
  </table>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_close($connexion);
?>
Si vous avez une idée, je vous en serai reconnaissant.
Cordialement.