Write in file.html using a PHP form

Results 1 to 2 of 2
  1. #1
    Head Developer LogiN is offline
    True MemberRank
    Mar 2012 Join Date
    SROTEAMLocation
    283Posts

    smile Write in file.html using a PHP form


    RaGEZONE Recommends

    RaGEZONE Recommends

    Hello all friends, I'm trying to make a form that is able to write to a html file created.

    What I need is that through the form, I can write only in specific areas, for example:

    Code:
    <title>HERE_TITLE FROM INPUT</title>
    This is my code work:
    Code:
    <div class="jumbotron">
            <h1>Script Auto</h1>
            <p class="lead">Extract File</p>
            
    		<?php ?>    
    		<form action="" method="post" enctype="multipart/form-data" class="form-horizontal">
    		  <div class="form-group">
    			<label for="inputEmail3" class="col-sm-2 control-label">Archivo ZIP</label>
    			<div class="col-sm-10">
    				<input type='submit' class="btn btn-sm btn-success" name='unZIP' value='Unzip file' />&nbsp;<br/><br/>
    			</div>
    		  </div>
    		
    		 <div class="form-group">
    			<label for="inputEmail3"  type="text" name="keyword" class="col-sm-2 control-label">Lang </label>
    			<div class="col-sm-10">
    				<select class="form-control">
    					  <option value="de"> de</option>
    					  <option value="en"> en</option>
    				</select>
    			</div>
    		 </div>
    		 
    		 <div class="form-group">
    			<label for="inputPassword3" class="col-sm-2 control-label">Title ( title)</label>
    			<div class="col-sm-10">
    			  <input type="text" class="form-control" id="inputPassword3" placeholder="NAME_HERE">
    			</div>
    		 </div>
    		 
    		  <div class="form-group">
    			<div class="col-sm-offset-2 col-sm-10">
    			  <button type="submit" class="btn btn-sm btn-success">Send</button>
    			</div>
    		  </div>
    		  	<p style="border-radius: 2px !important; background-color: rgba(51, 51, 51, 0.66);" class="bg-info">
    				<kbd><kbd>Console: </kbd><kbd style="font-weight: 100; color:#00ff00;"> 
    				
    				<?php 
    
    					// Get Path dir
    					define('_PATH', dirname(__FILE__));
    
    					//Unzip File
    					if(isset($_POST['unZIP'])){
    						
    						//Filename ZIP
    						$filename = 'file.zip';
    						$zip = new ZipArchive;
    						$res = $zip->open($filename);
    						if ($res === TRUE) {
    							// Unzip on Path
    							$path = _PATH."/file/";
    
    							// Unzipfile
    							$zip->extractTo($path);
    							$zip->close();
    
    							echo 'Success';
    						} else {
    							echo 'Failed!';
    						}
    					}
    
    				?>...</kbd></kbd>
    			</p>
    		</form>
    		<?php ?>
    	 </div>
    Look:


    What it does is unzip the file file.zip and then through the form edit the .html file that was generated when it was extracted in the path: file/de/index.html

    It's the only thing I do not understand in what way.
    Could someone help me?
    Thanks!
    Interactive Development
    Server Solutions Online
    SROTeam ® 2012


  2. #2
    Programmer TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: Write in file.html using a PHP form

    Can you elaborate on what exactly is and isn't working the way you expect right now?
    Last edited by TimeBomb; 29-05-17 at 12:57 AM.




Advertisement