sega Posted July 13, 2009 Share Posted July 13, 2009 I have been facing this PHP scripting problem. I put it up on some other forums but I did not go anywhere. I did a quick Google and found this as a PHP Forum, so I thought I would put it up. I'm new to PHP and the code I use is something I found and later altered. I code is of a form, the form works, but it is suppose to send the form in the Greek language, and it simply does not send it when you try inputting Greek characters. There are two files, one to send the form and another to process it. From - gr_contact.php <form method="post" action="gr_sendemail_pr.php"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <div class="frmcontact"> <div class="row"> <div class="ttl">Όνομα</div> <div class="frm"> <input type="text" name="firstname" /> </div> </div> <div class="row"> <div class="ttl">Επώνυμο:</div> <div class="frm"> <input type="text" name="surname" /> </div> </div> <div class="row"> <div class="ttl">Θέση:</div> <div class="frm"> <input type="text" name="position" /> </div> </div> <div class="row"> <div class="ttl">Εταιρεία:</div> <div class="frm"> <input type="text" name="company" /> </div> </div> <div class="row"> <div class="ttl">Διεύθυνση:</div> <div class="frm"> <input type="text" name="address" /> </div> </div> <div class="row"> <div class="ttl">Πόλη:</div> <div class="frm"> <input type="text" name="city" /> </div> </div> <div class="row"> <div class="ttl">Email:</div> <div class="frm"> <input type="text" name="email" /> </div> </div> <div class="row"> <div class="ttl">Τηλέφωνο:</div> <div class="frm"> <input type="text" name="telephone" /> </div> </div> <div class="row"> <div class="ttl">Φαξ:</div> <div class="frm"> <input type="text" name="fax" /> </div> </div> <div class="row"> <div class="ttl">Ενδιαφέρον:</div> <div class="frm"> <select name="enquiring_about"> <option value="motor_insurance" selected="selected">Motor Insurance</option> <option value="fire_burglury">Fire and Burglury</option> <option value="life_health">Life and Health</option> <option value="liability">Liability</option> <option value="personal">Personal</option> <option value="group">Group</option> <option value="business">Business</option> </select> </div> </div> <div class="row"> <div class="ttl">Μήνυμα</div> <div class="frm"> <textarea rows="2" cols="20" name="message"></textarea> </div> </div> <div class="row"> <div class="btn"> <input type="submit" value="Submit" /> <input type="reset" value="Clear" /> </div> </div> </div> </form> gr_sendmail_pr.php <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $val = 4; $firstname = $_POST['firstname']; $surname = $_POST['surname']; $position = $_POST['position']; $company = $_POST['company']; $address = $_POST['address']; $city = $_POST['city']; $email = $_POST['email']; $telephone = $_POST['telephone']; $fax = $_POST['fax']; $enquiring_about = $_POST['enquiring_about']; $user_message = $_POST['message']; if (eregi('http:', $user_message)) { $val = 1; echo ("<p class=\"val_title\">Κανένα Σχόλιο στο πεδίο 'Comments'</p>\n"); echo ("<p>Καταχωρήστε μήνυμα στο πεδίο 'Comments' </p>"); echo ("<div class=\"return\"><a href=\"en_contact.php\">Επιστροφή στη φόρμα</a></div>"); } if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))){ $val = 1; echo ("<p class=\"val_title\">Άκυρο email</p>\n"); echo ("<p>Καταχωρήστε έγκυρη διεύθυνση email</p>"); echo ("<div class=\"return\"><a href=\"en_contact.php\">Επιστροφή στη φόρμα</a></div>"); } if(empty($firstname) || empty($surname) || empty($position) || empty($company) || empty($address) || empty($city) || empty($email) || empty($telephone) || empty($fax) || empty($enquiring_about) || empty($user_message)){ $val = 1; echo ("<p class=\"val_title\">Ελλειπή πεδία</p>\n"); echo ("<p>Όλα τα πεδία να συμπληρωθούν ώστε να σταλεί η φόρμα</p>"); echo ("<div class=\"return\"><a href=\"en_contact.php\">Επιστροφή στη φόρμα</a></div>"); } if($val == 4){ $todayis = date("l, F j, Y, g:i a") ; $attn = $attn; $subject = $firstname." ".$surname." -"." ".$enquiring_about; $notes = stripcslashes($notes); $message = " $todayis [EST] \n \n \n From: $firstname $surname ($email)\n Equiring About: $enquiring_about \n Message: $user_message \n \n \n Firstname: $firstname \n Surname: $surname \n Position: $position \n Company: $company \n Address: $address \n City: $city \n Email: $email \n Telephone: $telephone \n Fax: $fax \n \n \n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $email\r\n"; mail("mymail@email.com", $subject, $message, $from);} if($val == 4){echo ("Ευχαριστώ ".$firstname." η απάντηση θα σταλεί στο email σας ".$email);} ?> The form works perfectly in English, the problem lies with submitting it in Greek, does anybody have any advice? Quote Link to comment Share on other sites More sharing options...
btherl Posted July 13, 2009 Share Posted July 13, 2009 It's probably a character set issue. You can find exactly which part causes the problem by starting with submitting an all-english form, then progressively add greek to various parts until you find which causes problems. If it's just the email body, you can attach any kind of data using MIME. Quote Link to comment Share on other sites More sharing options...
sega Posted July 13, 2009 Author Share Posted July 13, 2009 MIME.. oh man, I am such a noob. I will look into it and do as you advised. Quote Link to comment Share on other sites More sharing options...
sega Posted July 14, 2009 Author Share Posted July 14, 2009 I still could not solve the problem, I am not much of a coder. I think I will have to tell the client that I cannot do it, I wish there was a simpler solution. Quote Link to comment 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.