Jump to content

Paramter formating help needed

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
ilerbob

ilerbob

    Newbie

  • Members
  • Pip
  • 2 posts
Hi all,

I have just started working with PHP to support some of the websites I have and I'm working on a form mailer program and need some advice. Below is the code that passes multiple form fiels into my PHP script, My goal is to include the field names and the values in a plan text email. It works as is but I would like to put each variable on a new line. Is ther a way to imbed a line feed in the $allmsg field message to do this? Thanks in advance for your suggestions!
<?php
  $email = $_REQUEST['email'] ;
  $FirstName = $_REQUEST['FirstName'] ;
  $LastName = $_REQUEST['LastName'] ;
  $emailaddr = $_REQUEST['emailaddr'] ;
  $HomePhone = $_REQUEST['HomePhone'] ;
  $CellPhone = $_REQUEST['CellPhone'] ;
  $message = $_REQUEST['message'] ;
  $allmsg = "Name:".$FirstName." ".$LastName." Cell:".$CellPhone." Home:".$HomePhone." Email:".$emailaddr." Request:".$message;
mail("service@somewebsite.com", "Website Service Request:",
   $allmsg, "From: $emailaddr" );
 
  
?>


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Yes, just use \n:
$allmsg = "Name:".$FirstName."\n ".$LastName."\n Cell:".$CellPhone." Home:".$HomePhone." Email:".$emailaddr." Request:".$message;
mail("service@somewebsite.com", "Website Service Request:",


#3
ilerbob

ilerbob

    Newbie

  • Members
  • Pip
  • 2 posts
I figured it out, I had to imbed line feeds "\n" in my statement.

#4
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Just for the reference, a line feed is ASCII character 10, and a carriage return is ASCII character 13. It comes in handy when you don't have access to escape sequences (eg VB).
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Those ASCII characters also come in very handy when writing Assembly. It is kind of sad I know most of the ASCII characters decimal/hex values.

#6
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
But an admirable skill nonetheless.

For anyone who needs it, to return a character in VB based on its ASCII you just call Chr() and pass an integer parameter.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums