Jump to content

Novice php coder - HMTL formatting within PHP question


garp2100

Recommended Posts

Hello everyone! first post here, I"m running a very simple php form from a site and I was wondering if somebody could help me figure out the html formatting in order to add some line breaks and bold some text areas.

 

<?php

$mailto = 'mail@mail.com' ;

$subject = "mail@mail.com" ;

$formurl = "http://www.site.com" ;
$errorurl = "http://www.site.com/error.htm" ;
$thankyouurl = "http://www.site.com/thankyou.htm" ;

$uself = 0;

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$sex = $_POST['sex'];
$dob = $_POST['dob'];
$cap_name = $_POST['cap_name'];
$cap_phone = $_POST['cap_phone'];
$wit_name = $_POST['wit_name'];
$wit_phone = $_POST['wit_phone'];
$fishing_club = $_POST['fishing_club'];
$location = $_POST['location'];
$county = $_POST['county'];
$species = $_POST['species'];
$species2 = $_POST['species2'];
$species3 = $_POST['species3'];
$species4 = $_POST['species4'];
$species5 = $_POST['species5'];
$catch_date = $_POST['catch_date'];
$catch_date2 = $_POST['catch_date2'];
$catch_date3 = $_POST['catch_date3'];
$catch_date4 = $_POST['catch_date4'];
$catch_date5 = $_POST['catch_date5'];
$length = $_POST['length'];
$length2 = $_POST['length2'];
$length3 = $_POST['length3'];
$length4 = $_POST['length4'];
$length5 = $_POST['length5'];
$amount = $_POST['amount'];
$amount2 = $_POST['amount2'];
$amount3 = $_POST['amount3'];
$amount4 = $_POST['amount4'];
$amount5 = $_POST['amount5'];
$division = $_POST['division'];
$division2 = $_POST['division2'];
$division3 = $_POST['division3'];
$division4 = $_POST['division4'];
$division5 = $_POST['division5'];
$line_test = $_POST['line_test'];
$line_test2 = $_POST['line_test2'];
$line_test3 = $_POST['line_test3'];
$line_test4 = $_POST['line_test4'];
$line_test5 = $_POST['line_test5'];
$mono_braid = $_POST['mono_braid'];
$mono_braid2 = $_POST['mono_braid2'];
$mono_braid3 = $_POST['mono_braid3'];
$mono_braid4 = $_POST['mono_braid4'];
$mono_braid5 = $_POST['mono_braid5'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email)) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"<b>Angler Name:</b> $name\n" .
"Address: $address\n" .
"City: $city" ."  ". "State: $state" ."  ". "Zip: $zip\n" .
"Phone: $phone" ."  ". "Email: $email\n" .
"Sex: $sex" ."  ". "Date of Birth: $dob\n" .
"Captain's Name: $cap_name" ."  ". "Captain's Phone: $cap_phone\n" .
"Witness Name: $wit_name" ."  ". "Witness Phone Number: $wit_phone\n" .
"Fishihng Club Affiliation: $fishing_club\n" .
"Location of Catch: $location" ."  ". "County: $county\n" .
"Species: $species" ."  ". "$species2" ."  ". "$species3" ."  ". "$species4" ."  ". "$species5\n" .
"Date of Catch: $catch_date" ."  ". "$catch_date2" ."  ". "$catch_date3" ."  ". "$catch_date4" ."  ". "$catch_date5\n" .
"Length of Catch: $length" ."  ". "$length2" ."  ". "$length3" ."  ". "$length4" ."  ". "$length5\n" .
"Amount: $amount" ."  ". "$amount2" ."  ". "$amount3" ."  ". "$amount4" ."  ". "$amount5\n" .
"Division: $division" ."  ". "$division2" ."  ". "$division3" ."  ". "$division4" ."  ". "$division5\n" .
"Line Test: $line_test" ."  ". "$line_test2" ."  ". "$line_test3" ."  ". "$line_test4" ."  ". "$line_test5\n" .
"Mono/Braid: $mono_braid" ."  ". "$mono_braid2" ."  ". "$mono_braid3" ."  ". "$mono_braid4" ."  ". "$mono_braid5\n" .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.08" );
header( "Location: $thankyouurl" );
exit ;

?>

 

Thank you beforehand!

Link to comment
Share on other sites

<?php
$messageproper = <<< EOF
This message was sent from:
$http_referrer
------------------------------------------------------------

<b>Angler Name:</b> $name
Address: $address
City: $city  State: $state  Zip: $zip
Phone: $phone Email: $email
Sex: $sex Date of Birth: $dob
Captain's Name: $cap_name Captain's Phone: $cap_phone
Witness Name: $wit_name Witness Phone Number: $wit_phone
Fishihng Club Affiliation: $fishing_club
Location of Catch: $location County: $county
Species: $species $species2 $species3 $species4 $species5
Date of Catch: $catch_date $catch_date2 $catch_date3 $catch_date4 $catch_date5
Length of Catch: $length  $length2 $length3 $length4 $length5
Amount: $amount $amount2 $amount3 $amount4 $amount5
Division: $division $division2 $division3 $division4 $division5
Line Test: $line_test $line_test2 $line_test3 $line_test4 $line_test5
Mono/Braid: $mono_braid $mono_braid2 $mono_braid3 $mono_braid4 $mono_braid5

------------------------------------------------------------
EOF;

 

There you go. Wrap it up in some HTML and call it a day. You really did not need all that messy concatenation.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.