Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post

    <br/> to newline trouble

    Good day all:

    I've been experiencing a great difficulty resolving a problem concerning replacing
    Code:
    <br/>
    to an actual newline inside a textarea box. Much of the problem has been because the data in the textarea is populated via a php script in this manner:

    PHP Code:
        echo "formObj.servicedesc.value = '".toSafeString($inf["servicedesc"])."';\n"
    Inside my textarea box I get the following:
    Code:
    <textarea><br>On 12/01/10 @ 09:51<br>We performed the following:<br>
    information update<br/><br/>----End of Service Report----<br/><br/>On 12/01/10 @ 09:43<br/>We performed the following:<br/>
    information update<br/><br/>----End of Service Report----<br/><br/>On 11/29/10 @ 11:55<br/>We performed the following:<br/>
    Information update<br/><br/>----End of Service Report----<br/><br/>On 11/29/10 @ 04:41<br/>We performed the following:<br/>
    information update<br/><br/>----End of Service Report----<br/><br/>On 11/25/10 @ 09:34<br/>We performed the following:<br/>
    Information updateds<br/><br/>----End of Service Report----<br/><br/>On 11/25/10 @ 08:56<br/>We performed the following:<br/>
    We are performing an oil change<br/>Changing new brakes<br/>New tires<br/><br/>----End of Service Report----<br/>On 11/24/10 @ 09:43<br/>We performed the following:<br/>
    3Click here to add details of todays service<br/><br/>----End of Service Report----<br/><br/>On 11/24/10 @ 09:15<br/>We performed the following:<br/>
    <br/>On 11/22/10 @ 02:24<br/>We performed the following:<br/>
    Click here to add details of todays serviced<br/><br/>----End of Service Report----<br/></textarea>";
    Whereas, my ideal outcome is:
    Code:
    On 12/01/10 @ 09:51
    We performed the following:
    
    information update
    
    ----End of Service Report----
    
    On 12/01/10 @ 09:43
    We performed the following:
    
    information update
    
    ----End of Service Report----
    
    On 11/29/10 @ 11:55
    We performed the following:
    
    Information update
    
    ----End of Service Report----
    My textarea box is written in html as follows:
    Code:
    <textarea name="servicedesc" id="servicedesc" cols=60 rows=12 disabled="true" style="position: absolute; right: 13; top: 260">
    I have used numerous preg_replace functions but unable to resolve. I'm think I may be placing it incorrectly.

    Any assistance is greatly appreciated!
    Mossa
    Last edited by mbarandao; 12-03-2010 at 03:51 PM.

  • #2
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    try carriage return

    Code:
    function replacecarriagereturn(textarea,replaceWith)   
    {    
     textarea.value = escape(textarea.value);   
       //encode all characters in text area   
       //to find carriage return character   
     for(i=0; i < textarea.value.length; i++)   
     {    
      //loop through string, replacing carriage return    
      //encoding with HTML break tag   
      if(textarea.value.indexOf("%0D%0A") > -1)   
      {    
       //Windows encodes returns as \r\n hex   
       textarea.value=textarea.value.replace("%0D%0A",replaceWith);   
      }   
      else if(textarea.value.indexOf("%0A") > -1)   
      {    
       //Unix encodes returns as \n hex   
       textarea.value=textarea.value.replace("%0A",replaceWith);   
      }   
      else if(textarea.value.indexOf("%0D") > -1)   
      {    
       //Macintosh encodes returns as \r hex   
       textarea.value=textarea.value.replace("%0D",replaceWith);   
      }   
     }   
     textarea.value=unescape(textarea.value);   
    //decode all characters in text area back   
    }

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Thanks for the expeditious response, Data Talk. As I am quite new to this, could you please tell me where should I place this function?

    I'm assuming that it may go inside the php script that is retrieving the data from mysql and displaying in the html if such is the case here is my php script:

    PHP Code:
    <?php
    $connection 
    mysql_connect("localhost:xxxx","xxxxx","xxxxxx");  
    mysql_select_db("shop",$connection);

      function 
    toSafeString($string) {
       
    $string preg_replace('/[\r\n]/s''\\n'$string);
       
    //$string = preg_replace('/<br \/>/', '\n', $string);//I have tried this with no success
         
    return $string;
       }
       
    if(isset(
    $_GET['getClientId'])){ 
      
    $clientId preg_replace("/[^0-9|a-z|A-Z]/si"""$_GET['getClientId']);
      
    $res mysql_query("select * from ajax_client where clientID='".$_GET['getClientId']."'") or die(mysql_error());
      
    //$res = mysql_query("UPDATE ajax_client SET drivenmileage=currentmileage-previousmileage");// this is the correct string for mileage substraction however it clashed with client lookup
      
    if($inf mysql_fetch_array($res)){
        echo 
    "formObj.firstname.value = '".toSafeString($inf["firstname"])."';\n";    
        echo 
    "formObj.lastname.value = '".toSafeString($inf["lastname"])."';\n";    
        echo 
    "formObj.address.value = '".toSafeString($inf["address"])."';\n";    
        echo 
    "formObj.zipcode.value = '".toSafeString($inf["zipcode"])."';\n";    
        echo 
    "formObj.city.value = '".toSafeString($inf["city"])."';\n";    
        echo 
    "formObj.state.value = '".toSafeString($inf["state"])."';\n";
        echo 
    "formObj.dhtmlgoodies_category.value = '".toSafeString($inf["dhtmlgoodies_category"])."';\n";
        echo 
    "formObj.dhtmlgoodies_subcategory.value = '".toSafeString($inf["dhtmlgoodies_subcategory"])."';\n";
        echo 
    "formObj.caryear.value = '".toSafeString($inf["caryear"])."';\n";
        echo 
    "formObj.servicedesc.value = '".toSafeString($inf["servicedesc"])."';\n"
        echo 
    "formObj.theDate.value = '".toSafeString($inf["theDate"])."';\n";
        echo 
    "formObj.areacode.value = '".toSafeString($inf["areacode"])."';\n";
        echo 
    "formObj.phoneprefix.value = '".toSafeString($inf["phoneprefix"])."';\n";
        echo 
    "formObj.phonesufix.value = '".toSafeString($inf["phonesufix"])."';\n"
        echo 
    "formObj.email.value = '".toSafeString($inf["email"])."';\n"
        echo 
    "formObj.cellareacode.value = '".toSafeString($inf["cellareacode"])."';\n";
        echo 
    "formObj.cellprefix.value = '".toSafeString($inf["cellprefix"])."';\n";
        echo 
    "formObj.cellsufix.value = '".toSafeString($inf["cellsufix"])."';\n";
        echo 
    "formObj.previousmileage.value = '".toSafeString($inf["previousmileage"])."';\n";
        
    //echo "formObj.currentmileage.value = '".toSafeString($inf["currentmileage"])."';\n";
        
    echo "formObj.servicearea.value = '".toSafeString($inf["servicearea"])."';\n";
        echo 
    "formObj.commentonclient.value = '".toSafeString($inf["commentonclient"])."';\n";
        echo 
    "formObj.drivenmileage.value = '".toSafeString($inf["drivenmileage"])."';\n"

      }
      else
      {
        echo 
    "formObj.firstname.value = '';\n";    
        echo 
    "formObj.lastname.value = '';\n";    
        echo 
    "formObj.address.value = '';\n";    
        echo 
    "formObj.zipcode.value = '';\n";    
        echo 
    "formObj.city.value = '';\n";    
        echo 
    "formObj.state.value = '';\n";
        echo 
    "formObj.dhtmlgoodies_category.value = '';\n";
        echo 
    "formObj.dhtmlgoodies_subcategory.value = '';\n";
        echo 
    "formObj.caryear.value = '';\n";
        echo 
    "formObj.servicedesc.value = '';\n";
        echo 
    "formObj.theDate.value = '';\n";
        echo 
    "formObj.areacode.value = '';\n";
        echo 
    "formObj.phoneprefix.value = '';\n";
        echo 
    "formObj.phonesufix.value = '';\n";
        echo 
    "formObj.email.value = '';\n";
        echo 
    "formObj.cellareacode.value = '';\n";
        echo 
    "formObj.cellprefix.value = '';\n";
        echo 
    "formObj.cellsufix.value = '';\n";
        echo 
    "formObj.previousmileage.value = '';\n";
        
    //echo "formObj.currentmileage.value = '';\n";
        
    echo "formObj.servicearea.value = '';\n";
        echo 
    "formObj.commentonclient.value = '';\n";
        echo 
    "formObj.drivenmileage.value = '';\n";
         
            }    

    }

    ?>
    How should I implement your suggestion inside this file?

  • #4
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    did you try adding "<br> in front of your code?

    Code:
    echo "<br>formObj.firstname.value = '".toSafeString($inf["firstname"])."';\n";

  • #5
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Another way would be

    Code:
    <table border="0" width="100%" cellspacing="1" style="border-collapse: collapse">
    	<tr>
    <?php
    		echo "<td>output code in here</td>"
    		echo "<td>output code in here</td>"
    ?>
    	</tr>
    </table>

  • #6
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Yes! this too causes the script to become unresponsive. (writing in response to
    Code:
    echo "<br>formObj.firstname.value = '".toSafeString($inf["firstname"])."';\n";
    suggestion
    Last edited by mbarandao; 12-03-2010 at 03:23 PM.

  • #7
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Code:
    <table border="0" width="100%" cellspacing="1" style="border-collapse: collapse">
    	<tr>
    <?php
    		echo "<td>output code in here</td>"
    		echo "<td>output code in here</td>"
    ?>
    	</tr>
    </table>
    For this, I need a bit of clarification!

  • #8
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    just output your code in html, should work fine

    Code:
    <table border="0" width="100%" cellspacing="1" style="border-collapse: collapse">
    <tr>
    <!-- put this above your php code -->
    <?php
    // copy your code in here
    
    
    
    // echo your output code in the <td> tags
          echo "<td>output code in here</td>"
          echo "<td>output code in here</td>"
    
    ?>
    <!-- put this below your php code -->
    </tr>
    </table>

  • #9
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    I'm not sure that this would be ideal for my task. Employing this strategy, I believe would greatly impact the structure of the page that is displaying the data.

    I may have an incorrect understanding of your implementation suggestion, but the following is my html that receives the data via an ajax script

    Code:
    <body onLoad="initFormEvents()"; "document.onmousemove= document.onkeypress= function()" style="background-color: #C0C0C0" topmargin="6" marginheight="6">
    <div style="position: absolute; width: 1116px; height: 100px; z-index: 2; left: 11px; top: 27px; background-color: #00FFFF" id="layer2">
    <img border="0" src="transmission-repair.png" width="1117" height="100"></div>
    <br>
    <p>&nbsp;</p>
    <form name="clientForm" action="ajax-client_lookup.html" method="post">	
    	<fieldset style="width: 100%; height: 470">
    		<legend align="left"><b><font size="4" color="#FF0000">Client information</font></b></legend>
    		<div style="position: absolute; width: 138px; height: 149px; z-index: 3; left: 443px; top: 230px; background-color: #000000; bottom:-7" id="layer3">
    	<DIV style="position: absolute; left: 4px; top: 7px" name="image" id="image"></DIV>
    
    
    &nbsp;</div>
    		<table width="1142">
    			<tr>
    				<td><label for="clientID">License Plate Number:</label></td>
    				<td>
    				<input name="clientID" id="clientID" size="17" maxlength="16" style="background-color: #00FFFF" value="Enter Car Plate#"> &nbsp;&nbsp;
    <a class="button" href='#'><span>CLICK TO SEARCH</span></a>
    </b></td>
    				<td>
    				<p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    				</p>
    				<div style="position: absolute; width: 519px; height: 455px; z-index: 1; left: 621px; top: 192px; background-color:#FFFFFF" id="layer1">
    
    					<table border="0" width="100%" height="372">
    						<tr>
    							<td height="26">
    							<p align="center"><font size="4">Vehicle Details<hr color="#C0C0C0" size="1">
    							</font></td>
    						</tr>
    						<tr>
    						<td VALIGN="top" width="1%" style="border-left: 2px dotted" color="#CCCCCC;">
    						<p align="right"><label for="theDate">Customer Since:</label>
    						<input type="text" name="theDate" size="20" style="padding: 0" disabled="true"></p>
    						<p align="left">
    						<label for="dhtmlgoodies_category">Make:</label>
    						<input type="text" name="dhtmlgoodies_category" id="dhtmlgoodies_category" size="14" style="padding: 0" disabled="true"> 
    						<label for="dhtmlgoodies_subcategory">Model:</label> 
    						<input type="text" name="dhtmlgoodies_subcategory" size="15" style="padding: 0" disabled="true"> 
    						<label for="caryear">Year:</label>
    						<input type="text" name="caryear" size="5" style="padding: 0" disabled="true"></p>
    						<label for="previousmileage">Last Recorded Mileage:</label>
    						<input type="text" name="previousmileage" id="previousmileage" size="20" disabled="true"><br>
    						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="drivenmileage">Driven Miles 
    						between the last two visits:</label>
    						<input type="text" name="drivenmileage" id="drivenmileage" size="5" disabled="true">
    						<br>
    						<label for="servicearea">We Last Worked on your vehicle in this area:</label>
    						<input type="text" name="servicearea" size="20" style="padding: 0" disabled="true"><br>
    						<br>
    						<label for="servicedesc">Service History:</label>
    						&nbsp;	
    						<!--<div id="servicedesc" name="servicedesc"></div>	-->
    						<textarea name="servicedesc" id="servicedesc" cols=60 rows=12 disabled="true" style="position: absolute; right: 13; top: 260"></textarea></td>
    																		</tr>
    					</table>
    					
    				</div>
    				</td>
    			</tr>
    			<tr>
    				<td><label for="firstname">First name:</label></td>
    				<td>
    				<input name="firstname" id="firstname" size="20" maxlength="255" disabled="true"></td>
    				<td>
    				&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="lastname">Last name:</label></td>
    				<td>
    				<input name="lastname" id="lastname" size="20" maxlength="255" disabled="true"></td>
    				<td>
    				&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="address">Address:</label></td>
    				<td>
    				<input name="address" id="address" size="20" maxlength="255" disabled="true"></td>
    				<td>
    				&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="zipcode">Zip code:</label></td>
    				<td><input name="zipcode" id="zipcode" size="8" maxlength="5" disabled="true"></td>
    				<td>&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="city">City:</label></td>
    				<td><input name="city" id="city" size="20" maxlength="255" disabled="true"></td>
    				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
    			</tr>
    			<tr>
    				<td><label for="state">State:</label></td>
    				<td>
    				<input name="state" id="state" size="20" maxlength="255" disabled="true"></td>
    				<td>
    				&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="tel_number">Phone #:</label></td>
    				<td>
    				<input name="areacode" id="areacode" size="3" maxlength="3" disabled="true">-<input name="phoneprefix" id="phoneprefix" size="3" maxlength="3" disabled="true">-<input name="phonesufix" id="phonesufix" size="4" maxlength="4" disabled="true"></td>
    							</tr>
    
    			<tr>
    				<td><label for="email">Email:</label></td>
    				<td>
    				<input name="email" id="email" size="42" maxlength="25" disabled="true"></td>
    				<td>
    				&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="cell_number">Alt. Phone#:</label></td>
    				<td>
    				<input name="cellareacode" id="cellareacode" size="3" maxlength="3" disabled="true">-<input name="cellprefix" id="cellprefix" size="3" maxlength="3" disabled="true">-<input name="cellsufix" id="cellsufix" size="4" maxlength="4" disabled="true"></td>
    				<td>&nbsp;</td>
    			</tr>
    			<tr>
    				<td><label for="commentonclient">Special Comment on Client:</label></td>
    				<td>
    				<p align="left">
    				<textarea name="commentonclient" id="commentonclient" cols=36 rows=6 disabled="true"></textarea>
    		</tr>
    				<td>
    				&nbsp;</tr>
    		</table>	
    	</form>
    		<div id="instruct"><h5>INSTRUCTIONS:</h5>TYPE LICENSE PLATE NUMBER AND HIT TAB KEY <p>NOTE: NO CHANGES ARE MADE ON THIS SCREEN. USE EDIT CLIENT FOR SUCH TASK!</p></div>
    &nbsp;&nbsp;</fieldset>
    				<td>&nbsp;</td>
    				<td>
    				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <div id="menuoption"><a href="home.php">	RETURN TO MAIN</a> 
    --|-- <a href="addclient.php">ADD NEW CLIENT </a>&nbsp;--|-- 
    <a href="addentry.php">EDIT ClIENT</a>&nbsp;&nbsp;&nbsp;
    <br></div>
    <div id="logos"><p align="right">&nbsp;<i><font size="2" color="#FFFFFF"><img border="0" src="images/systempowered3.png" ></font></p></div>
    </body></html></table>
    this is the ajax script that calls the php
    Code:
    var ajax = new sack();
    	var currentClientID=false;
    	function getClientData()
    	{
    		var clientId = document.getElementById('clientID').value.replace(/[^0-9|a-z|A-Z]/g,'');//here to incorporate the client id with numbers and letters
    		if(clientId.length >0 && clientId!=currentClientID){//here to change the client id lenght
    			currentClientID = clientId
    			ajax.requestFile = 'getClient.php?getClientId='+clientId;	// Specifying which file to get
    			ajax.onCompletion = showClientData;	// Specify function that will be executed after file has been found
    			ajax.runAJAX();		// Execute AJAX function			
    		}
    		
    	}
    	
    	function showClientData()
    	{
    		var formObj = document.forms['clientForm'];	
    		eval(ajax.response);
    		//ajax.getElementByID().response;
    	}
    	
    	
    	function initFormEvents()
    	{
    		document.getElementById('clientID').onblur = getClientData;
    		document.getElementById('clientID').focus();
    	}
    	//window.onload = initFormEvents;
    		</script>
    Note: I mention ajax with no implied request for support in such area; as my concern, I believe is with php.

    Mossa-
    Last edited by mbarandao; 12-03-2010 at 04:15 PM.

  • #10
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Have you considered your echo "output" in an iframe

  • #11
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Thanks for the continued suggestions. I'm will attempt a solution that address my problem.

    How would this work based on the articulated concern?
    ie: if this is my iframe,

    Code:
    <iframe name="servicedesc" frameborder=0 scrolling=no width=100%  src="" onload="adjustMyFrameSize();" height="300" align="left"></iframe>
    what would be the value of src=""?

  • #12
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    I'm not sure how you are requesting the data here?

    if you are posting the data you would target that frame

    <form method="post" action="yourIframename.php" target="NameOfIframe">
    Last edited by DataTalk; 12-03-2010 at 06:37 PM.

  • #13
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Sorry! I have been trying to piece together what you are trying to do..

    After viewing your form code, I use a different method to load form data and have not seen data loaded that way.

    FYI:
    the method i use is

    Code:
    if($_GET['id']) {
    // select database 
    $result = mysql_query("SELECT * FROM businesses WHERE id=".$_GET['id']);
    $row = mysql_fetch_object($result) ;?>
    <input type="hidden" name="id" value="<?php print $_GET['id'] ?>" >
    <?php } ?>
    
    <input name="Bus_Name" type="text" value="<?php print $row->Bus_Name ?>">
    This method will also load all the related data,
    Sorry i cant help you on this

  • #14
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    PHP Code:
      function toSafeString($string) {  
       
    $string preg_replace('/[\r\n]/s'"\n"$string);  
       
    $string preg_replace('/<br\s?\/?>/i'"\n"$string);
       return 
    $string;  

    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog

  • #15
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Data Talk, thank you for your attempts!

    Lamped, I have tried that function with no success!


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •