Hello,
I have a contact form in html.
I want either label or input value in bold and color as output by email.
How can I get it?
Thanks
Arun
Your question is a bit hard to understand. Could you post the code you are working with and say a bit more about what’s not working?
Thanks for your kind reply. Sorry, if my question was vague. Code is something like this:
<form id="kontaktformular" class="kontaktformular" action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post" enctype="multipart/form-data">
<div class="row">
<td> <div class="col-sm-8 <?php if ($fehler["full_name"] != "") { echo 'error'; } ?>">
<label class="control-label"><b><i>Full Given Birth Name</i> *</b></label>
<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Name" placeholder=" Name" type="text" style="height:100%;width:100%;" name="name" class="field" value="<?php echo $_POST['name']; ?>" maxlength="<?php echo $number_of_characters_name; ?>">
<?php if ($fehler["name"] != "") { echo $fehler["name"]; } ?>
</td></div></form>
I want to receive by email something like this:
Name = strong textemphasized textArun (in red color)
OR
strong textemphasized textName (in red color) = Arun
I mean that I want to receive by email either label or value in strong textemphasized text with red color.
Hope I am clear now.
Thanks
Looks like in my previous reply some fields are not sent:
<form id="kontaktformular" class="kontaktformular" action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post" enctype="multipart/form-data">
div class="row">
<td> <div class="col-sm-8 <?php if ($fehler["name"] != "") { echo 'error'; } ?>">
<label class="control-label"><b><i>Name</i> *</b></label>
<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Name *" placeholder="Name *" type="text" style="height:100%;width:100%;" name="name" class="field" value="<?php echo $_POST['name']; ?>" maxlength="<?php echo $number_of_characters_name; ?>">
<?php if ($fehler["name"] != "") { echo $fehler["name"]; } ?>
</div></td></div></form>
@drapm: when you post code, you need to format it so it will display correctly. I’ve edited your post for you, but for future reference, please either highlight your code and use the code button in the editor window, or place three backticks ``` on a row above your code, and three below.
Oh!
OK thanks
I appreciate.
Best regards
Where is the code that you use to build and send the email message? That’s the part that you’ll need to modify so that certain parts of the email appear in different colours or fonts. But isn’t that just a case of sending the email as html, and putting the correct tags around the various elements?
The code is in my previous reply.
Unless I’m reading it wrong, that’s the code for your form, where the data is entered by the user. The code to actually take that information and send it as an email will be somewhere else.
Or are you saying that you want to change the colour of the information on the form? It’s this bit that makes me think you want to alter the contents of the email:
Data entered by the user is coming to me like this:
\\
\\
Or are you saying that you want to change the colour of the information on the form? It’s this bit that makes me think you want to alter the contents of the email:
That is correct - I want data entered by user to come to me in color and bold italic.
Thanks.
The code you’ve shown is just the form that allows the user to enter the data. There will be some more PHP code in your file, the section will start with a line that’s something like
if ($_SERVER['REQUEST_METHOD']=="POST"{
and should end with a corresponding }
character. There should be a call to the mail
() function, or references to PHPMailer
or similar functions. That’s the code you need to post, not the form code.
Unless it’s absolutely massive, you could just post the entire script, removing any sensitive information like passwords or genuine email addresses before you post.
It is indeed a massive code. I can sent it only by email.
Another option is to provide you website link where from I got this form script, if it is allowed on this forum.
Can you separate the section that actually processes the form input and just post that?
I hope this may help:
\\
I hope this may help:
<?php function sendMyMail($fromMail, $fromName, $toMail, $subject, $content, $attachments=array()){ $boundary = md5(uniqid(time())); $eol = PHP_EOL; $header = "From: =?UTF-8?B?".base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol; $header .= "Reply-To: <".$fromMail.">".$eol; $header .= "MIME-Version: 1.0".$eol; if(is_array($attachments) && 0<count($attachments)){ $header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\""; } else{ $header .= "Content-type: text/plain"; } $subject = "=?UTF-8?B?".base64_encode($subject)."?="; return mail($toMail, $subject, $message, $header); } \\\ </blockquote> </aside> <p>\\</p>
\\
^ Please edit your post as @Technobear described in an earlier post, so that your code is readable.
I’m struggling with that function - you pass in a parameter called $content
which is presumably the content of the email message (the body, if you like) and then you don’t use it at all. Your call to mail()
actually uses a variable called $message
, which doesn’t appear anywhere else in the function. I’m surprised your emails aren’t completely blank.
<?php function sendMyMail($fromMail, $fromName, $toMail, $subject, $content, $attachments=array()){ $boundary = md5(uniqid(time())); $eol = PHP_EOL;
$header = "From: =?UTF-8?B?".base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol;
$header .= "Reply-To: <".$fromMail.">".$eol; $header .= "MIME-Version: 1.0".$eol;
if (is_array($attachments) && 0<count($attachments))
{ $header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\""; } else{ $header .= "Content-type: text/plain"; }
$subject = "=?UTF-8?B?".base64_encode($subject)."?="; return mail($toMail, $subject, $message, $header); }
Sorry, I can’t see how that code segment varies from the one you posted in post 15, in that you still pass in $content
and don’t use it anywhere, and still use $message
which isn’t defined anywhere.
Please look at this post, though, for any future code segments that you upload, as that solid block of text is very difficult to read:
when you post code, you need to format it so it will display correctly. I’ve edited your post for you, but for future reference, please either highlight your code and use the code button in the editor window, or place three backticks ``` on a row above your code, and three below.
@drapm: I’ve formatted your post for you again.
You need to use backticks ```, not back-slashes \. (On a UK keyboard, it’s at the top left corner. I’m not sure about other keyboards.)
I see you are using the PHP mail() function to send the email. If you want emboldened and coloured text, you will need to send the email as HTML and not plain text. To try to do this with PHP mail() would be a nightmare. You need to look at using PHPMailer to send the email.