[phorm] [Phorm:] Re: Removing underscore characters

  • From: webbbs@xxxxxxxxx
  • To: support@xxxxxxxxx
  • Date: 23 Jul 2003 02:27:51 -0000

The following new message has been posted on Phorm Support Forum at 
<http://www.phorm.com/support/>. 

*************************************************************************** 

  MESSAGE:  (#3042) Re: Removing underscore characters 
            <http://www.phorm.com/support/?rev=3042> 
  AUTHOR:   Patrick O'Hara 
  DATE:     July 22, 2003 at 10:27 p.m. EST 

  Reply To: (#3040) Removing underscore characters 
  Author:   Roger Miller 
  Date:     July 22, 2003 at 1:45 p.m. EST 

> Hi Alan, 

You got me, will I do? :) 

> I understand that field names are converted to PHP 
> variables and therefore cannot contain spaces. In my 
> case the field names are strings that contain the 
> title/teachername/price of the classes (which change 
> weekly). 

> Is there an easy way to replace the underscore 
> characters with spaces when the field names are 
> printed on the confirmation page and in the email? The 
> information from the email gets cut-and-pasted into a 
> "please mail your check to" template. It's 
> pretty frustrating if all the embedded underscores 
> have to be replaced manually. 

I'm not 100% sure what you are exactly trying to do - if you are adding the 
field names to a page that you are hard coding, ie typing the details into, 
then you can use a find and replace found in most text editors. If you are 
wanting to do this process on the fly, when you go to output the field name, 
use PHP's str_replace function: 

$name = str_replace("_", " ", $name); 

(where $name is the variable containing the field name not the variable 
containing the value of the field name.) 

If you are looking for a list of all the field names, you can access the array 
of $_POST variables. 

> Please keep in mind that I failed regular expression 
> in both elementary and high school. 

Took me ages to get it right too... There is a regular expression alternative, 
but the str_replace() function works well if you don't need to find and 
replace complicated strings. 

If you need any more information, please let me know. 

Regards, 

Patrick O'Hara 
WhitsundayIT 
QLD, Australia 

patrick@xxxxxxxxxxxxxxxx 
www.whitsundayit.com 

*************************************************************************** 

This is an automatically-generated notice.  If you'd like to be removed from 
the mailing list, please visit Phorm Support Forum at 
<http://www.phorm.com/support/>, or send your request to webbbs@xxxxxxxxxx  If 
you wish to respond to this message, please post your response directly to the 
board.  Thank you! 
-------------------------------------------------
You are receiving this message because you are subscribed to the Phorm mailing 
list. To send messages to the mailing list, simply send email to 
phorm@xxxxxxxxxxxxx from the address you have subscribed. You may unsubscribe 
from the list by sending email to phorm-request@xxxxxxxxxxxxx with 
'unsubscribe' in the SUBJECT field.

Other related posts:

  • » [phorm] [Phorm:] Re: Removing underscore characters