Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/09/2008, 14:17
Avatar de Quclii
Quclii
 
Fecha de Ingreso: julio-2008
Ubicación: Guadalajara
Mensajes: 76
Antigüedad: 15 años, 9 meses
Puntos: 0
Exclamación Como importar archivos a un textarea ?

mi pregunta es como puedo de un archivo puedo pasarlo a un textarea para poder modifikar el archivo si utiliso un radio button para seleccionar la opcion de modifikar y en un text box pongo el nombre del archivo ke kiero modificar y utilizo un boton para abrir el archivo en ste kaso kiero ke me lo ponga en un textarea ke se llama datos
como le puedo hacer ?


Codigo De Leer Archivo
Código:
<Html>

  <Body>

     <?php

        $abrir=$_POST["abrir"];
        $forma=$_POST["forma"];

        if($forma==lectura){
                              $datos = file_get_contents($abrir);
	                          $datos = explode(' ',$datos);
	                          foreach($datos as $elemento){
	                                                        print(" ");
	                                                        print($elemento);
                                                          
                            }
        else{
	          $datos = file_get_contents($abrir);
	          $datos = explode(' ',$datos);
	          foreach($datos as $elemento){
       aqui es donde creo yo que deberia de poner el codigo para ke me haga la funcion
                                          }
            }

     ?>

  </Body>

</Html>
Codigo De Crear Archivo
Código:
<Html>
<style type="text/css">
<!--
.Estilo1 {
	font-family: "Lucida Console";
	font-size: 12px;
}
-->
</style>

   <Body>

      <?php

          $archivo=$_POST["archivo"];
          $datos=$_POST["datos"];
          $ingreso = file_put_contents($archivo,$datos);

      ?>

      <span class="Estilo1">Archivo Creado</span> <a href="Inicio.Html" class="Estilo1">REGRESAR</a>

   </Body>

</Html>

Pagina Principal
Código:
<HTML>
<style type="text/css">
<!--
.Estilo1 {
	font-family: "Lucida Console";
	font-size: 12px;
}
.Estilo2 {font-size: 12px}
.Estilo3 {font-family: "Lucida Console"}
-->
</style>

   <Script>

        function Valid (){
                           var x = event.keyCode
                           status=x
								
                           if( x > 48 && x < 57 || x == 32 ){
                                                              return true; 
                                                            }
                           return false;
                         }

       function Documento(){
                             document.form1.datos.value = document.form1.datos.value + ' ';
     
                      }
   </Script>

   <Body>


       <form name="form1" method="post" action="Crear.php">

             <p class="Estilo2"><span class="Estilo3">Nombre Archivo:</span> 
               <input type="text" name="archivo">
         </p>
             <p><span class="Estilo1">Ingresar Numeros Enteros :</span> 
               <textarea name="datos" cols="30" onKeyup="Documento()" onKeyPress="return Valid()"></textarea>
           </p>
             <p> 
               <input name="submit" type="submit" value="Guardar">
             </p>
       </form>

       <form method="post" action="Leer.php">
           
             <p>
               <input type="text" name="abrir">
               <input type="submit" value="Abrir">
             </p>
             <p>
               <input name="forma" type="radio" value="lectura" checked>
               <span class="Estilo1">LECTURA
               <input name="forma" type="radio" value="modific"> 
                MODIFICAR         </span></p>
       </Form>
       
   </Body>

</Html>


por favor ayudenme!!!

Última edición por Quclii; 09/09/2008 a las 16:05