Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello,

I'm in the process of validating my HTML Form with PHP Validation.

One of the strings that is being posted (set as $address) is an address field, and when someone types in the textarea:

123 Test Road
Test Town
Test City
TE5 TPC


It needs to be validated into:

123 Test Road, Test Town, Test City, TE5 TPC

Before the SQL query begins.

Can anyone help me?
Regards,
Tom
Posted

1 solution

Take a look at this link were you will see the escape chars: http://www.tizag.com/phpT/strings.php[^]

Take a look at this one were the replace function is explained:
http://php.net/manual/en/function.str-replace.php[^]

See this as it is doing exactly what you want:
http://stackoverflow.com/questions/3986299/how-to-remove-new-lines-and-returns-from-php-string[^]

Good luck!
 
Share this answer
 
Comments
thomasriley 29-Aug-12 7:23am    
Perfect Joan thankyou!
Joan M 29-Aug-12 7:24am    
You are welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900