![]() |
#1 |
![]() Join Date: Feb 2016
Posts: 5
|
![]() I have used the Dreamweaver Club php form for a while now and have got good results.
From here: http://www.dreamweaverclub.com/dreamweaver-php-form.php Issue I now have is that I have users now in Russia and results are coming to me in some garbled format such as "ХелŒсинки" instead of Russian text. Can anyone advise how to edit the php from that link above so that the results would come to me as plain text email including Russian characters? I guess its something to do with not having any reference to UTF-8 but I have no idea how to implement that. Thanks ... |
![]() |
![]() |
![]() |
#2 |
![]() ![]() Join Date: Aug 2005
Location: Bali
Posts: 11,216
|
![]() that is really not my advice to use that script ,
you need to add headers which is really needed and add $ headers = "Content-Type: text/html; charset= UTF-8"; a rough example of using mail() $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: <webmaster@example.com>' . "\r\n"; $headers .= 'Cc: myboss@example.com' . "\r\n"; mail($to,$subject,$message,$headers);
__________________
If you're happy and you know it shake your meds! different style links examples Flight / Hotel search Free script download Bali Villas Last edited by edbr; 03-20-2018 at 12:44 AM.. |
![]() |
![]() |
![]() |
#3 |
![]() Join Date: Feb 2016
Posts: 5
|
![]() Ive really tried but failed to have any success. Can you show inside this code where to change it so it works? Thanks.
... <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Results from Contact form'; // Your email address. This is where the form information will be sent. $emailadd = 'mail@rdsnetworks.net'; // Where to redirect after form is processed. $url = 'http://www.rdsnetworks.net/confirmation.html'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> |
![]() |
![]() |
![]() |
#4 |
![]() ![]() Join Date: Aug 2005
Location: Bali
Posts: 11,216
|
![]() ok ill look tomorrow when i have some spare time
__________________
If you're happy and you know it shake your meds! different style links examples Flight / Hotel search Free script download Bali Villas |
![]() |
![]() |
![]() |
#5 |
![]() Join Date: Feb 2016
Posts: 5
|
![]() Thanks
![]() |
![]() |
![]() |
![]() |
#6 |
![]() ![]() Join Date: Aug 2005
Location: Bali
Posts: 11,216
|
![]() well i didnt but here is a form and script that hopefuly will do the job.
try if you will in a new folder ,and let me know the result first a form with some html5 valdation / reminders form.html Code:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Contact</title> <style> #form{ position:relative; width: 500px; margin:0 auto; } label { float:left; clear:left; } input[type="text"], [type="url"], [type="email"]{ float:left; color: #555 ; width: 70%; border: 1px solid #e5e5e5; background: #fbfbfb; height: 25px; } .textarea{ float:left; height:100px; width: 70%; } </style> </head> <body> <div id="form"> <form action="sendmail.php" method="post"> <fieldset> <label for="name">Name:</label> <input id="name" name="name" type="text" required placeholder=" Your name" > </fieldset> <fieldset> <label >Email:</label> <input type="email" id="email" name="email" placeholder="me@mymail.com" required > </fieldset> <fieldset> <label>Message</label> <textarea class="textarea" name="Message" id="Message" ></textarea> </fieldset> <fieldset> <input type="submit" name="Submit" value="Submit"> <input name="reset" type="reset"> </fieldset> </form> </div> </body> </html> Code:
<?php if (isset($_POST['Submit']) && $_POST['name'] != "") { $th_url= "http://www.rdsnetworks.net/confirmation.html"; // modify to page redirect after mail succsessfully sent if ($_POST['name'] != "") { $_POST['name'] = filter_var($_POST['name'], FILTER_SANITIZE_STRING); if ($_POST['name'] == "") { $errors .= 'Please enter a valid name.<br/><br/>'; } } else { $errors .= 'Please enter your name.<br/>'; } if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } else { $errors .= 'Please enter your email address.<br/>'; } if ($_POST['Message'] != "") { $_POST['Message'] = filter_var($_POST['Message'], FILTER_SANITIZE_STRING); if ($_POST['Message'] == "") { $errors .= 'Please enter a message to send.<br/>'; } } else { $errors .= 'Please enter a message to send.<br/>'; } $headers = "From: " . strip_tags($_POST['email']) . "\r\n"; $headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8"; if (!$errors) { $to = 'mail@rdsnetworks.net'; $subject = 'New Mail from ' . $_POST['email']; $message = 'From: ' . $_POST['name'] ."<br>"; $message .= 'Email from: ' . $_POST['email'] . "<br>"; $message .= "Message:\r\n" . $_POST['Message'] ."<br>"; mail($to, $subject, $message,$headers); header("Location: $th_url"); } else { echo '<div style="color: red">' . $errors . '<br/></div>'; } } ?>
__________________
If you're happy and you know it shake your meds! different style links examples Flight / Hotel search Free script download Bali Villas |
![]() |
![]() |
![]() |
#7 |
![]() Join Date: Feb 2016
Posts: 5
|
![]() Thanks very much for what you sent.
I actually already have a (quite long) Form, and it works, except the results I receive do not show the Cyrillic characters. That was why I was hoping to just add something/edit something to the existing .php file I already have to allow it to do that. I could adapt your form code, but I am not sure how to do that --- do I have to have code for every form element? Also, when I use your form and .php from above, on Submitting the form I get a Error Message: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. Last edited by Mosaic; 03-21-2018 at 08:15 AM.. |
![]() |
![]() |
![]() |
#8 |
![]() ![]() Join Date: Aug 2005
Location: Bali
Posts: 11,216
|
![]() well im lost as i tested it so best leave it then. the resource missing does not make sense to me. i coded it to accept russian characters.
yes you have to add the items is not hard but if you cant i dont know what to suggest
__________________
If you're happy and you know it shake your meds! different style links examples Flight / Hotel search Free script download Bali Villas |
![]() |
![]() |
![]() |
#9 |
![]() Join Date: Feb 2016
Posts: 5
|
![]() Hmm, you sound annoyed. Sorry to have bothered you.
|
![]() |
![]() |
![]() |
#10 |
![]() ![]() Join Date: Aug 2005
Location: Bali
Posts: 11,216
|
![]() not angry but if i cant recreate a 500 warning not much i can do
__________________
If you're happy and you know it shake your meds! different style links examples Flight / Hotel search Free script download Bali Villas |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|