php - Textarea line break no working properly -


i have best problem in experience, want write .htaccess file fwrite(), when debug show ok in side textarea when going submit show \n\r\n\r.... try str_replace() , work not break line. codes, please me.

submit.php

<?php  //.htaccess file write , rewrite query  $file = ".htaccess";  $submit7 = $_post['submit7'];  $edit = mysql_real_escape_string(str_replace( array("\r\n", "\n"), " ", $_post['edit']));     function wee() {      echo "<ifmodule mod_rewrite.c> \n \n rewriteengine on \n";      require('config2.php'); $getquery=mysql_query("select * menu order menu_id desc"); while($rows=mysql_fetch_assoc($getquery)){$menu_id=$rows['menu_id']; $linkname=$rows['linkname'];  echo "\n rewriterule ^".$linkname."/{0,1}$  pagee.php?menu_id=".$menu_id. "[qsa,l] \n"; }      echo "\n </ifmodule>";    }          if ($submit7) {     if ( is_writable( $file ) ) {         // is_writable() not reliable, check return value. see comments @ http://uk.php.net/is_writable         $f = fopen( $file, 'w+');         if ( $f !== false ) {             fwrite( $f, $edit );             fclose( $f );          }     } }    ?>      <form id="form7" name="form7" method="post" action="<?php echo $_server['php_self']; ?>">       <label>         <input type="submit" name="submit7" value="write" />       </label>  <textarea name="edit"><?php echo wee(); ?></textarea>        </form> 

config2.php

<?php  mysql_connect("localhost","root",""); mysql_select_db("myweb");   ?>   <?php $con = mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db ("myweb"); ?> 

sql.sql

-- -- database: `myweb` --  -- --------------------------------------------------------  -- -- table structure table `menu` --  create table if not exists `menu` (   `menu_id` int(11) not null,   `mname` text not null,   `level` text not null,   `linkname` text not null ) engine=innodb auto_increment=5 default charset=latin1;  -- -- dumping data table `menu` --  insert `menu` (`menu_id`, `mname`, `level`, `linkname`) values (1, 'home', 'home', 'aaaa'), (2, 'music', 'music', 'music'), (3, 'movie', 'movie', 'movie'), (4, 'song', 'song', 'song');  -- -- indexes dumped tables --  -- -- indexes table `menu` -- alter table `menu`   add primary key (`menu_id`);  -- -- auto_increment dumped tables --  -- -- auto_increment table `menu` -- alter table `menu`   modify `menu_id` int(11) not null auto_increment,auto_increment=5; /*!40101 set character_set_client=@old_character_set_client */; /*!40101 set character_set_results=@old_character_set_results */; /*!40101 set collation_connection=@old_collation_connection */; 

.htaccess --- output result showing

<ifmodule mod_rewrite.c>  rewriteengine on  rewriterule ^song/{0,1}$  pagee.php?menu_id=4[qsa,l]  rewriterule ^movie/{0,1}$  pagee.php?menu_id=3[qsa,l]  rewriterule ^music/{0,1}$  pagee.php?menu_id=2[qsa,l]  rewriterule ^aaaa/{0,1}$  pagee.php?menu_id=1[qsa,l]  </ifmodule> 

but want this:

<ifmodule mod_rewrite.c>    rewriteengine on    rewriterule ^song/{0,1}$  pagee.php?menu_id=4[qsa,l] rewriterule ^movie/{0,1}$  pagee.php?menu_id=3[qsa,l]   rewriterule ^music/{0,1}$  pagee.php?menu_id=2[qsa,l]   rewriterule ^aaaa/{0,1}$  pagee.php?menu_id=1[qsa,l]    </ifmodule> 

please please please me......

ok dear think find result replacement ok,

submit.php

<?php //.htaccess file write , rewrite query  $file = ".htaccess"; $submit7 = $_post['submit7'];  if ($submit7)  {    $htfe = file_put_contents('.htaccess', $_post['edit']); }  function wee()  {     echo "<ifmodule mod_rewrite.c> \n     \n rewriteengine on \n";     require('config2.php'); $getquery=mysql_query("select * menu order menu_id desc"); while($rows=mysql_fetch_assoc($getquery)){$menu_id=$rows['menu_id']; $linkname=$rows['linkname'];     echo "\n rewriterule ^".$linkname."/{0,1}$  pagee.php?menu_id=".$menu_id. "[qsa,l] \n"; }     echo "\n </ifmodule>"; } ?>  <form id="form7" name="form7" method="post" action="<?php echo $_server['php_self']; ?>">       <label>         <input type="submit" name="submit7" value="write" />       </label>       <textarea name="edit"><?php echo wee(); ?></textarea> </form> 

i thing should solution, ok change file submit.php ok


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -