Jump to content

[SOLVED] whats this white space, like a tab but not?


jesushax

Recommended Posts

hi all the below is copied from my source

 


12345687 	   

 

if you copy it then start deleteing after 4 deletes it jumps like a tab space, but i tired a str_replace to remove the tab spacing didnt work

 

function NoSpaces($text) {
$text = str_replace("	","",$text);
return $text;
}

Link to comment
Share on other sites

right ive just copied that dodgy text into a page now and im trying everything to get rid of it

 

i even copied and pasted the whole gap into the str_replace and that didnt work :|

 

<?php
$data = "12345687 	   ";

str_replace(" 	   ","",$data);

echo $data;
?>

Link to comment
Share on other sites

This

<?php
$data = "12345687 	   ";

str_replace(" 	   ","",$data);

echo $data;
?>

willl not work, since you don't change the value of $data.

 

This

<?php
$data = "12345687 	   ";

$data = str_replace(" 	   ","",$data);

echo $data;
?>

 

or

 

<?php
<?php
$data = "12345687 	   ";

$data = str_replace("\t","",$data);

echo $data;
?>

 

Should.

 

Ken

Link to comment
Share on other sites

hmm well the text seems to still have some sort of spacing character in there

 

<?php
$text = "12345687 	   ";

$text = str_replace("\t","",$text);
$text = str_replace("  ","",$text);
$text = str_replace("   ","",$text);
$text = str_replace("    ","",$text);
$text = str_replace("     ","",$text);
$text = str_replace("      ","",$text);
$text = str_replace("       ","",$text);
$text = str_replace("        ","",$text);

echo $data;
?>

 

gives me the below

the tabs gone but theres still spacing if you highlight it, what can this spacing be?


12345687    

Link to comment
Share on other sites

well heres the code that make this happen

 

form data goes to register.php

 

register.php


$_SESSION["PostData"] = $_POST;

 

so i can recall the form data if the users gets redirected becuase of an errror, eg. they havent put in a required field

 

so when the user is redirected back to regform

 

regform.php

$post = $_SESSION["PostData"];

<input name="Sect1_6" type="text"size="30" value="<?php echo NoSpaces($post["Sect1_6"]);  ?>
   " <?php
   if($error == "email") {
   echo 'style="border:1px solid #FF0000;"';
   } 
   ?> 
       />

 

no spaces function

function NoSpaces($text) {
$text = str_replace("\t","",$text);
$text = str_replace("  ","",$text);
$text = str_replace("   ","",$text);
$text = str_replace("    ","",$text);
$text = str_replace("     ","",$text);
$text = str_replace("      ","",$text);
$text = str_replace("       ","",$text);
$text = str_replace("        ","",$text);

return $text;
}

 

and in that field i have the value

12345687  

 

which has those wierd spaces trailing it, we got rid of the tab not theres these smaller spaces that look just like spaces but there not?

 

 

 

Link to comment
Share on other sites

awww bloody hell im such an idiot lol

 

it was working just my code for my form field...

 

i had it like

 

<input name="Sect1_5" type="text" size="15" value="<?php

  if($action == "edit") {

  echo $row["Sect1_5"];

  } else {

  echo NoSpaces($post["Sect1_5"]);

  }

  ?>

  "  />

 

leaving spaces after the value has been posted, god dammit lol

 

sorry for wasting your time :| sowiiiiiii!

 

THanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.