how remove the space

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
qumar
Forum Commoner
Posts: 29
Joined: Wed Nov 01, 2006 8:20 am

how remove the space

Post by qumar »

Everah | Please use the appropriate bbCode tags when posting code in our forums. Thanks.
hi,

give some idea. all are working fine. but test s should be tests. no need space between test and s. please help to me.
run this program. enter the the following string in the text box.
test's tested5/ new? "working" new-fine\

Code: Select all

<?php

$process=$_GET['process'];
if(empty($process))		$process="addNew";

if($process=="insert")
{
	//test's tested5/ new? "working" new-fine\
		
	$event=$_POST['event'];			
	
	echo $test=preg_replace('/[^a-zA-Z]/',' ',$event);
}

if($process=="addNew")
{

$content="<form action='".$_SERVER['PHP_SELF']."?process=insert' method='post'>
<table border='1' align='center' width='300'>
<tr><td>Event Name</td><td><input type='text' name='event' value=''></td></tr>
<tr><td colspan='2' align='center'><input type='submit' name='submit' value='Submit'></td></tr>
</table></form>";

	echo $content;

}

?>
thanks,
qumar.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

didn't look in all that. try to simplify what you ask for.
Have you tried str_replace() ' ' with '' -> space with empty string?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What are you trying to accomplish?
Post Reply