Jump to content

Recommended Posts

Hi,

 

I have a form, where after a submit button the information is coming to my email. I want to put that information in the table, and make the headers such as name, phone, address - bold.  Where do I put that code for styling? please help.

 

here is my form php code

<?php

            if (array_key_exists('button',$_POST)) {

            $post = $_POST;

            $first_name = $_POST['first_name'];

$last_name = $_POST['last_name'];

$company = $_POST['company'];

$address1 = $_POST['address1'];

$address2 = $_POST['address2'];

$city = $_POST['city'];

$state = $_POST['state'];

$zip = $_POST['zip'];

$phone = $_POST['phone'];

$phone2 = $_POST['phone2'];

            $email = $_POST['email'];

$comments = $_POST['message'];

 

$ins_company = $_POST['ins_company'];

$claim = $_POST['claim'];

$agent = $_POST['agent'];

$agent_phone = $_POST['agent_phone'];

$adjuster = $_POST['adjuster'];

$adjuster_phone = $_POST['adjuster_phone'];

 

 

$fire = $_POST['fire'];

$storm = $_POST['storm'];

$water = $_POST['water'];

$pier = $_POST['pier'];

$freeze = $_POST['freeze'];

$vandalism = $_POST['vandalism'];

 

$Appliances = $_POST['Appliances'];

$Architect = $_POST['Architect'];

$Asphalt = $_POST['Asphalt'];

$Ceiling = $_POST['Ceiling'];

$Tile = $_POST['Tile'];

$Concrete = $_POST['Concrete'];

$Content = $_POST['Content'];

$Demolition = $_POST['Demolition'];

$Doors = $_POST['Doors'];

 

$Dry = $_POST['Dry'];

$Electrical = $_POST['Electrical'];

$Excavation = $_POST['Excavation'];

$Fencing = $_POST['Fencing'];

$Woodwork = $_POST['Woodwork'];

$Flooring = $_POST['Flooring'];

$Hardware = $_POST['Hardware'];

$Heating = $_POST['Heating'];

 

$Insulation = $_POST['Insulation'];

$Ironwork = $_POST['Ironwork'];

$Masonry = $_POST['Masonry'];

$Painting = $_POST['Painting'];

$Plaster = $_POST['Plaster'];

$Plumbing = $_POST['Plumbing'];

$Refinishing = $_POST['Refinishing'];

$Remodeling = $_POST['Remodeling'];

 

$Roofing = $_POST['Roofing'];

$Carpentry = $_POST['Carpentry'];

$Security = $_POST['Security'];

$Siding = $_POST['Siding'];

$Specialties = $_POST['Specialties'];

$Structural = $_POST['Structural'];

$Wall = $_POST['Wall'];

 

 

 

$autoreply=

"Dear $name,

 

Thank you for contacting Duckstein Contracting Inc. We will be responding to you within the next 48 hours.  Should you need to speak to someone more promptly, please call us at (412) 331-6257.

 

Sincerely,

 

The Staff at Duckstein Contracting Inc.";

 

            $subject="Thank you $first_name!";

    mail($email, $subject, $autoreply);

           

            $expected = array('first_name','last_name', 'email', 'address', 'phone2', 'state', 'phone', 'city', 'zip','company',  'subject','ins_company','claim','agent','agent_phone','adjuster','adjuster_phone', 'fire', 'storm', 'Appliances', 'Architect', 'Asphalt','Ceiling', 'Tile', 'Concrete', 'Content', 'Demolition', 'Doors', 'Dry', 'Electrical','Excavation','Fencing', 'Woodwork', 'Flooring', 'Hardware', 'Heating', 'Insulation', 'Ironwork', 'Masonry', 'Painting', 'Plaster', 'Plumbing', 'Refinishing', 'Remodeling', 'Roofing', 'Carpentry', 'Security', 'Siding', 'Specialties', 'Structural', 'Wall', 'message');

 

            $required = array('first_name','last_name', 'email', 'phone');

            $missing = array();

           

           

            foreach ($_POST as $key => $value) {

            $temp = is_array($value) ? $value : trim($value);

            if (empty($temp) && in_array($key, $required)) {

            array_push($missing, $key);

            }

            elseif (in_array($key, $expected)) {

            ${$key} = $temp;

            }

            }

           

            if (!empty($email)) {

            $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';

            if (!preg_match($checkEmail, $email)){

              array_push($missing, 'email');

              }

            }

           

            if (empty($missing)){

           

            $to = 'm@gmail.com';//put your email here

            $subject = 'Duckstein Contracting Inc. - New Claim'; // you can put what ever subject you want here'

 

 

           

            $message = "First Name: $first_name\n\n";

$message .= "Last Name: $last_name\n\n";

$message .= "Company: $company\n\n";

$message .= "Address: $address\n\n";

$message .= "Address 2: $address2\n\n";

$message .= "City: $city\n\n";

$message .= "State: $state\n\n";

$message .= "Zip Code: $zip\n\n";

$message .= "Phone Number: $phone\n\n";

$message .= "Phone (secondary): $phone2\n\n";

$message .= "E-mail: $email\n\n";

  $message .= "Comments: $comments\n\n";

 

 

 

 

$message .= "Insurance Company: $ins_company\n\n";

$message .= "Claim Number: $claim\n\n";

$message .= "Agent: $agent\n\n";

$message .= "Agent Phone: $agent_phone\n\n";

$message .= "Adjuster: $adjuster\n\n";

$message .= "Adjuster phone: $adjuster_phone\n\n";

 

$message .="Damage to Property:\n\n";

foreach ($damage as $damage){

$message.="$damage\n\n";}

 

$message .="Services Required:\n\n";

foreach ($services as $services){

$message.="$services\n\n";}

 

 

           

            $message = wordwrap($message, 70);

           

            $additionalHeaders = "From: $email";

            if (!empty($email)) {

            $additionalHeaders .= "\r\nReply-To: $email";

            }

           

            $mailSent = mail($to, $subject, $message, $additionalHeaders);

           

            if (empty($missing)){

           

            }

            elseif (empty($missing)){

            $mailSent = true;

            }

           

            if ($mailsent = true){

            unset($missing);

            unset($post);

              }

              } 

            }

           

            ?>

 

Link to comment
https://forums.phpfreaks.com/topic/182039-styling-the-form/
Share on other sites

how would you normally style an html table? something like

<table class="tableStyle">

or

<table style="background-color:black" >

 

wherever your table is, add the style text in there. If your table is being created in the php, then you have to set the styles in the php. For example, if I wanted to change the following table

$table = '<table><td>Cell</td></table>';

 

to have a black background, and white font color, I could do

$table = '<table style="background-color:black; font-color: white"><td>Cell</td></table>';

 

Link to comment
https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960275
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.