<?
if (isset($_REQUEST["submit"])){
	extract($_REQUEST);//extraigo todos los tx a variables locales
	$cid=odbc_connect("mydsn","","");	
	$sql="Select max(idfotografia) from fotos";
	$result=odbc_exec($cid,$sql);
	$codigo=odbc_result($result,1)+1;
	$sql="Insert into fotos values($codigo,$t2,$t3,'$t4','$t5','$t6','$t7','$t8','$t9')";
	$result=odbc_exec($cid,$sql)or die(exit("Error en odbc_exec()<br>$sql"));
	if (!$result){
	 print "Algo no se ejecutó bien.";
	}
	else{
	 print "Información guardada.\n";
	 }
}
?>
<html>
<head>
<title>Ejemplo de ODBC http://Myphp.webcindario.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
td {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>

<body bgcolor="#DBDBDB" onLoad="MM_goToURL('parent.frames[\'topFrame\']','top.php');return document.MM_returnValue">
<div id="Layer1" style="position:absolute; left:401px; top:17px; width:180px; height:102px; z-index:1; background-color: #333333; layer-background-color: #333333; border: 1px none #000000;"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Aqui 
  puedes guardar nuevos datos. No se verifica nada, ni fecha ni hora ni datos 
  vacios.<br>
  <? print $msg ?></font></div>
<form action="" method="post" enctype="multipart/form-data" name="form1">
  <table width="50%" border="0">
    <tr> 
      <td>Id fotografia</td>
      <td><input name="t1" type="text" id="t1" value="Este es autonum&eacute;rico" readonly="true"></td>
    </tr>
    <tr> 
      <td>Id pelicula</td>
      <td><input name="t2" type="text" id="t2"></td>
    </tr>
    <tr> 
      <td>Num fotografia</td>
      <td><input name="t3" type="text" id="t3"></td>
    </tr>
    <tr> 
      <td>Fecha tomada</td>
      <td><input name="t4" type="text" id="t4" value="yyyy/mm/dd"></td>
    </tr>
    <tr> 
      <td>Hora tomada</td>
      <td><input name="t5" type="text" id="t5" value="hh:mm:ss"></td>
    </tr>
    <tr> 
      <td>Lugar tomado</td>
      <td><input name="t6" type="text" id="t6"></td>
    </tr>
    <tr> 
      <td>El que la tom&oacute;</td>
      <td><input name="t7" type="text" id="t7"></td>
    </tr>
    <tr> 
      <td>Tama&ntilde;o de impresion</td>
      <td><input name="t8" type="text" id="t8"></td>
    </tr>
    <tr> 
      <td>Notas</td>
      <td><input name="t9" type="text" id="t9"></td>
    </tr>
    <tr> 
      <td colspan="2"><input type="reset" name="Submit2" value="Reset"> <input name="submit" type="submit" id="submit" value="Guardar"></td>
    </tr>
  </table>
</form>
</body>
</html>
