Automatically removes space from $_POST variables- Need help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Automatically removes space from $_POST variables- Need help

Post by DevPHP »

while posting any variables from one page to another page, automatically it is removing the space between the words using $_POST method. Need help pls. Thanks in advance friends. :(
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Automatically removes space from $_POST variables- Need help

Post by panic! »

what happens when you run.


<?
print var_dump($_POST);

?>

paste us the result.
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Re: Automatically removes space from $_POST variables- Need help

Post by DevPHP »

The value which enter in text area is 'New! Email Benchmark Guide 2008'. After submitting the page am getting 'New!EmailBenchmarkGuide2008' this as the posted value. even i didnt use php_strip_whitespace. Thanks for ur immediate reply.
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: Automatically removes space from $_POST variables- Need help

Post by Ziq »

show your PHP code

or try this:

Code: Select all

 
<?php
print_r($_POST);
?>
 
<form action="<?=$_SERVER['SCRIPT_NAME']?>" method="POST">
    <textarea name="text"></textarea><br>
    <input type="submit">
</form>
 
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Re: Automatically removes space from $_POST variables- Need help

Post by DevPHP »

whether any server settings may affect the post variable? Any chances to remove the spaces?
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Automatically removes space from $_POST variables- Need help

Post by panic! »

what happens when you run.

Code: Select all

 
<?
print var_dump($_POST);
 
?>
 
paste us the result.
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Re: Automatically removes space from $_POST variables- Need help

Post by DevPHP »

The value which enter in text area is 'New! Email Benchmark Guide 2008'. After submitting the page am getting 'New!EmailBenchmarkGuide2008' this as the posted value. even i didnt use php_strip_whitespace.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Automatically removes space from $_POST variables- Need help

Post by panic! »

Are you reading what I'm writing?


I don't know how to say this any simpler

this code:

Code: Select all

 
 <?
print var_dump($_POST);
 
  
?>
 
Copy and paste it into your script on your server, then run the script in your browser then copy and paste the result into a reply on this forum and click submit with your mouse.

Do you understand?
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Re: Automatically removes space from $_POST variables- Need help

Post by DevPHP »

i think u r expecting me to paste what am getting, but i just send u the thing which i saw in browser. Fine i got this as the result.
array(4) { 5["name"]=> string(4) "test" ["org"]=> string(4) "test" ["email"]=> string(0) "" ["comments"]=> string(51) "donotcontainoffensivecontentand(c)notanovertsales "}
DevPHP
Forum Newbie
Posts: 6
Joined: Tue Aug 26, 2008 2:37 am

Re: Automatically removes space from $_POST variables- Need help

Post by DevPHP »

Thank u so much for all who helped me to find out the solution. For validation purpose i used str_replace() to remove space. Thats y it removed all the space for the posted variables.
Post Reply