Creo que me he explicado mal... El fichero que se llama desde el action es el anterior:
Código PHP:
<?php echo $editFormAction; ?>
Asi que no se como hacerlo... :/
EDITO:
Este es mi codigo actual:
Código PHP:
<?php require_once('Connections/alumnos.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 alumnos (Imagen, Nombreyapellidos, `Tlf. Casa`, `Movil Padre`, `Movil Madre`, Email) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Imagen'], "text"),
GetSQLValueString($_POST['Nombreyapellidos'], "text"),
GetSQLValueString($_POST['Tlf_Casa'], "int"),
GetSQLValueString($_POST['Movil_Padre'], "int"),
GetSQLValueString($_POST['Movil_Madre'], "int"),
GetSQLValueString($_POST['Email'], "text"));
mysql_select_db($database_alumnos, $alumnos);
$Result1 = mysql_query($insertSQL, $alumnos) or die(mysql_error());
$insertGoTo = "alumnos.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>Insertar Alumno</title>
<script src="file:///C|/Archivos%20de%20programa/Adobe/Adobe%20Dreamweaver%20CS6/es_ES/Configuration/Third%20Party%20Source%20Code/jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="file:///C|/Archivos%20de%20programa/Adobe/Adobe%20Dreamweaver%20CS6/es_ES/Configuration/Third%20Party%20Source%20Code/jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="header">
<a href="javascript:history.back()">Atrás</a>
<h1>Insertar nuevo alumno</h1>
</div>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre y apellidos:</td>
<td><input type="text" name="Nombreyapellidos" value="" size="32" placeholder="No utilizar tildes" id="pagephp" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Tlf. Casa:</td>
<td><input type="text" name="Tlf_Casa" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Movil Padre:</td>
<td><input type="text" name="Movil_Padre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Movil Madre:</td>
<td><input type="text" name="Movil_Madre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="Email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insertar nuevo alumno" /></td>
</tr>
</table>
<input type="hidden" name="Imagen" value="Sin imagen" />
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
<p> </p>
<div data-role="footer">
<h4>PAGINA</h4>
</div>
</body>
</html>
Y este codigo me funciona a la perfección, pero no consigo meterle la variable:
Código PHP:
<?php
if ($archivo = fopen("asdf.php", "w")){
echo fwrite($archivo, "Hey esto funciona...");
fclose($archivo);
}
?>