how do i remove underscores from data from a form

Discussion in 'PHP' started by xtreme fever, Aug 18, 2006.

  1. #1
    hello,

    when i receive a form request, the text field name data in the e-mail shows an underscore everywhere a space should be. how do i fix this so that the text field name data is shown without the underscores?

    example: this_is_a_sample

    thanks
     
    xtreme fever, Aug 18, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $variablename= str_replace("_", " ", $variablename); 
    Code (markup):
     
    mad4, Aug 18, 2006 IP
  3. xtreme fever

    xtreme fever Active Member

    Messages:
    472
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #3
    thanks mad4, you rock
     
    xtreme fever, Aug 18, 2006 IP
  4. surefire

    surefire Guest

    Messages:
    40
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    And if you want to get a little fancier:

    $variablename= str_replace("_", " ", $variablename); 
    $variablename = ucwords(strtolower($variablename));
    
    Code (markup):
    Turns "foo_bar" into "Foo Bar"
     
    surefire, Aug 18, 2006 IP