lena_k198 Posted November 18, 2009 Share Posted November 18, 2009 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); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/ Share on other sites More sharing options...
mikesta707 Posted November 18, 2009 Share Posted November 18, 2009 Put your code in code tags please. if you want to add styles to something, do it like you would normally <input type="text" class="myStyle" /> or use the inline style attribute <input type="text" style="background-color: black" /> Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960240 Share on other sites More sharing options...
lena_k198 Posted November 18, 2009 Author Share Posted November 18, 2009 Where would I put this code? inside the php section? Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960246 Share on other sites More sharing options...
lena_k198 Posted November 18, 2009 Author Share Posted November 18, 2009 I think you did not understand my question. I need to style the table in my email! The output of the submitted form. How will I do that? Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960257 Share on other sites More sharing options...
mikesta707 Posted November 18, 2009 Share Posted November 18, 2009 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>'; Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960275 Share on other sites More sharing options...
lena_k198 Posted November 18, 2009 Author Share Posted November 18, 2009 where do I set a $table value? sorry i am new with this Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960282 Share on other sites More sharing options...
lena_k198 Posted November 18, 2009 Author Share Posted November 18, 2009 If I want my $message value to be black color and "bold" font what do I do? Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960296 Share on other sites More sharing options...
emopoops Posted November 18, 2009 Share Posted November 18, 2009 check outhttp://www.phpfreaks.com/forums/index.php/topic,277448.0.html with php mail() ull get it Quote Link to comment https://forums.phpfreaks.com/topic/182039-styling-the-form/#findComment-960485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.