Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/08/2011, 09:04
Avatar de CesarHC
CesarHC
 
Fecha de Ingreso: junio-2011
Ubicación: localhost
Mensajes: 566
Antigüedad: 12 años, 11 meses
Puntos: 56
Respuesta: Duda sobre $_SERVER['PHP_SELF']

XD tienes razon aqui pongo el codigo el principio que es java es del calendario que tengo.

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>NOTAS DE PRENSA</title>
  5. <link rel="stylesheet" type="text/css" media="all" href="../jscalendar/skins/aqua/theme.css" title="Aqua" />
  6. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-blue.css" title="winter" />
  7. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-blue2.css" title="blue" />
  8. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-brown.css" title="summer" />
  9. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-green.css" title="green" />
  10. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-win2k-1.css" title="win2k-1" />
  11. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-win2k-2.css" title="win2k-2" />
  12. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
  13. <link rel="alternate stylesheet" type="text/css" media="all" href="../jscalendar/calendar-win2k-cold-2.css" title="win2k-cold-2" />
  14. <link rel="stylesheet" type="text/css" href="../css/admin.css"/>
  15. <link rel="alternate stylesheet" type="text/css" media="all" href="calendar-system.css" title="system" />
  16. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  17. <script type="text/javascript" src="../jscalendar/calendar.js"></script>
  18. <script type="text/javascript" src="../jscalendar/lang/calendar-es.js"></script>
  19. <script src="../css/jquery.js" type="text/javascript"></script>
  20. <script src="prueba.js" type="text/javascript"></script>
  21. <script type="text/javascript">
  22.  
  23. var oldLink = null;
  24.  
  25. function setActiveStyleSheet(link, title) {
  26.   var i, a, main;
  27.   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  28.     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
  29.       a.disabled = true;
  30.       if(a.getAttribute("title") == title) a.disabled = false;
  31.     }
  32.   }
  33.   if (oldLink) oldLink.style.fontWeight = 'normal';
  34.   oldLink = link;
  35.   link.style.fontWeight = 'bold';
  36.   return false;
  37. }
  38.  
  39. function selected(cal, date) {
  40.   cal.sel.value = date;
  41.   if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
  42.     cal.callCloseHandler();
  43. }
  44. function closeHandler(cal) {
  45.   cal.hide();                        
  46.   _dynarch_popupCalendar = null;
  47. }
  48. function showCalendar(id, format, showsTime, showsOtherMonths) {
  49.   var el = document.getElementById(id);
  50.   if (_dynarch_popupCalendar != null) {
  51.    
  52.     _dynarch_popupCalendar.hide();                
  53.   } else {
  54.     var cal = new Calendar(1, null, selected, closeHandler);
  55.     if (typeof showsTime == "string") {
  56.       cal.showsTime = true;
  57.       cal.time24 = (showsTime == "24");
  58.     }
  59.     if (showsOtherMonths) {
  60.       cal.showsOtherMonths = true;
  61.     }
  62.     _dynarch_popupCalendar = cal;                
  63.     cal.setRange(1900, 2070);      
  64.     cal.create();
  65.   }
  66.   _dynarch_popupCalendar.setDateFormat(format);    
  67.   _dynarch_popupCalendar.parseDate(el.value);      
  68.   _dynarch_popupCalendar.sel = el;                
  69.  
  70.   _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");      
  71.  
  72.   return false;
  73. }
  74.  
  75. var MINUTE = 60 * 1000;
  76. var HOUR = 60 * MINUTE;
  77. var DAY = 24 * HOUR;
  78. var WEEK = 7 * DAY;
  79.  
  80. function isDisabled(date) {
  81.   var today = new Date();
  82.   return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
  83. }
  84.  
  85. function flatSelected(cal, date) {
  86.   var el = document.getElementById("preview");
  87.   el.innerHTML = date;
  88. }
  89.  
  90. function showFlatCalendar() {
  91.   var parent = document.getElementById("display");
  92.   var cal = new Calendar(0, null, flatSelected);
  93.  
  94.   cal.weekNumbers = false;
  95.   cal.setDisabledHandler(isDisabled);
  96.   cal.setDateFormat("%A, %B %e");
  97.   cal.create(parent);
  98.   cal.show();
  99. }
  100. </script>
  101.  
  102.  
  103. </head>
  104. <?php  
  105. if (isset($_POST['submit'])) {  
  106.     if(is_uploaded_file($_FILES['fichero']['tmp_name'])) {
  107.    
  108.         $ruta_destino = ".../.../fotos/";
  109.         $ruta_destino2 = "http://localhost/fotos/";
  110.         $namefinal= trim ($_FILES['fichero']['name']);
  111.      
  112.         $uploadfile= $ruta_destino . $namefinal;  
  113.         $uploadfile2= $ruta_destino2 . $namefinal;  
  114.  
  115.         if(move_uploaded_file($_FILES['fichero']['tmp_name'], $uploadfile)) { // se coloca en su lugar final  
  116.                    
  117.                    
  118. //conectamos a la base de datos para almacenar los datos y la ruta del archivo
  119.  
  120. $server="localhost";
  121. $usuario="root";
  122. $pass="";
  123. $bd="bd";
  124. $link=mysql_connect($server,$usuario,$pass)or die (exit(mysql_error()));
  125.                  $id  = $_POST["id"];
  126.                    $fecha  = $_POST["fecha"];
  127.                    $titulo  = $_POST["titulo"];
  128.                    $descripcion  = $_POST["descripcion"];
  129.                   $query = "INSERT INTO notas_prensa  
  130.   VALUES ('$id','$fecha','$titulo','$descripcion', '".$uploadfile2."','".$uploadfile."')";
  131.    echo "<script languaje='javascript'>alert('Datos Guardados.')
  132.             document.location = ('../presentacion/frmnotas_prensag.php');
  133.             </script>";
  134.        
  135.  
  136.                    
  137.                    
  138.        mysql_query($query) or die(mysql_error());
  139.        
  140.         }  
  141.     }  
  142.  }
  143. //Formulario  
  144.  
  145. ?>
  146. <body onload="showFlatCalendar()" bgcolor="#F9F9F9">
  147. <script type="text/javascript">
  148. setActiveStyleSheet(document.getElementById("defaultTheme"), "Aqua");
  149. </script>
  150. </div>
  151.  
  152. <form action="frmnotas_prensag.php" method="post" enctype="multipart/form-data">  
  153. <h1 align="center" class="titulo">NUEVA NOTA DE PRENSA</h1>
  154. <table  align="center" id="datos" >
  155. <tr>
  156.     <th></th>
  157.     <td><input name="id" type="hidden" size="430"> </td>
  158.   </tr>
  159.   <tr>
  160.     <th>Imagen</th>
  161.     <td><input name="fichero" type="file" size="30" maxlength="150"></td>
  162.   </tr>
  163.   <tr>
  164.     <th>Fecha</th>
  165.     <td> <input type="text" name="fecha" id="sel4" size="30"  ><input type="reset" value=" ... "
  166. onclick="return showCalendar('sel4','%Y-%m-%d');"><div id="display" style="display:none"></div>  </tr>
  167.   <tr>
  168.     <th>Titulo</th>
  169.    
  170.     <td><input type="text" id="titulo"  size="30" name="titulo"/>
  171.       <input type="button" id="chequeo" value="Verificar"/>
  172.       <br/>
  173.       <div id="resultado"></div></td>
  174. </td>
  175.   </tr>
  176.   <tr>
  177.     <th>Descripcion</th>
  178.     <td ><textarea name="descripcion" cols="40" rows="10"></textarea> </td>
  179.   </tr>
  180.   <tr>
  181.     <td colspan="2" align="center"><input name="submit" type="submit" value="Guardar" id="button"></td>
  182.     </tr>
  183. </table>
  184.  
  185. </form>
  186. <div id="display" style="display:none"></div>
  187.             <p style="display:none"><small>
  188. </body>
  189. </html>
__________________
Solo la práctica no te traicionara ¡¡¡¡¡¡

Seguir el camino tu debes PHP The Right Way.