Page 1 of 1

how remove the space

Posted: Mon Oct 08, 2007 4:40 am
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.

Posted: Mon Oct 08, 2007 6:50 am
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?

Posted: Mon Oct 08, 2007 11:44 am
by RobertGonzalez
What are you trying to accomplish?