cloevvold Posted October 31, 2007 Share Posted October 31, 2007 I have a few issues with a contact form, and hope that someone can helt me here I wonder if it is possible to make "Produkt" appear in the email and in this message: "Dette er infomasjonen du sendte:" that the user get up after that he or she has send the info, even if I have set it to read only.. The user isnt suppose to be able to change that. I want this to appear at the top of the list (before name "navn") in the user message and the mail. And I have another problem. Special caracters (æøå) works everywhere when the user is filling out and get the message, But in the e-mail it dosent work? Hope someone can help me here Here is the scripts: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Noram Produkter A/S - Ventilasjon På Naturens Vilkår</title> <link rel="stylesheet" href="../../css/lightbox.css" type="text/css" media="screen" /> <script src="../../js/prototype.js" type="text/javascript"></script> <script src="../../js/scriptaculous.js?load=effects" type="text/javascript"></script> <script src="../../js/lightbox.js" type="text/javascript"></script> <style type="text/css"> #lightbox, #overlay { z-index:10000 !important; } </style> <link href="../../css/style.css" rel="stylesheet" type="text/css" media="all" /> </head> <body> <!-- ImageReady Slices (1_home.psd - Slices: 01, 03) --> <table width="759" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="759" height="566" ALT="" valign="top" bgcolor="#FFFFFF"> <table width="759" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="white" width="271" height="566" valign="top" alt="" style="background-position:bottom; background-repeat:no-repeat " background="../../bilder/hoved_design/buisness.jpg"><img src="../../bilder/hoved_design/logo.jpg" alt="" height="69" width="271" usemap="#logo16be78b" border="0" /><map name="logo16be78b"><area shape="rect" coords="27,14,243,58" href="../../index.html" alt="" /></map></td> <td width="488" height="566" alt="" valign="top" style="background-position:top right; background-repeat:no-repeat " background="../../bilder/hoved_design/girl.jpg"> <table width="488" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <menumachine name="mainmenu" id="m17wmfia"> <csobj t="Component" csref="../../menumachine/mainmenu/menuspecs.menudata"><noscript> <p><a class="mm_no_js_link" href="../../menumachine/mainmenu/navigation.html">Site Navigation</a></p> </noscript> </csobj> <script type="text/javascript"><!-- var mmfolder=/*URL*/"../../menumachine/",zidx=1000; //--></script> <script type="text/javascript" src="../../menumachine/menumachine2.js"></script> <script type="text/javascript" src="../../menumachine/mainmenu/menuspecs.js"></script> </menumachine> </td> </tr> </table> <div style="margin-left:31px; margin-top:24px; width:340px "> <br /> <br /> <img src="../../bilder/hoved_design/ventilasjon.jpg" alt="" width="232" height="20" border="0" /><br /> <br /> </div> <div style="margin-top:20px "> <table width="486" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td background="../../bilder/hoved_design/red_td.jpg" width="486" height="33" ALT="" valign="top"> <div style="margin-top:1px "> <table width="486" height="32" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="background-position:right; background-repeat:repeat-y " colspan="2" valign="top" width="486"> <div style="margin-left:29px; margin-top:12px "> <span class="bot_men"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Bestilling</font></b></span></div> </td> </tr> </table> </div> </td> </tr> <tr> <td width="486" height="312" ALT="" valign="top"> <table width="486" height="407" border="0" cellspacing="0" cellpadding="0" background="../../bilder/hoved_design/px1.jpg" style="background-position:right; background-repeat:repeat-y "> <tr> <td class="box_bestill" height="407" valign="top" background="../../bilder/hoved_design/px1.jpg" style="background-position:left; background-repeat:repeat-y "> <div style="margin-top:5px "> <div class="box_bestill"> <br /> <br /> <style type="text/css" media="screen"><!-- .readonly { color: #16287c; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; } --></style> <!-- BEGIN THE COPYING HERE!!!!!!! --><!-- beginning of the form --> <form METHOD=POST ACTION="contact_form.php"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> Produkt:</td> <td width="236"> <input class="readonly" type="text" name="produkt" value="Filter til Exvent Pingvin" disabled size="28"><br> </td> </tr> <tr height="8"> <td align="right" width="86" height="8"></td> <td width="236" height="8"></td> </tr> <tr> <td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td height="5"></td> </tr> </table> Betalingsmåte: </td> <td width="236"> <input class="readonly" type="text" name="produkt" value="Postoppkrav" disabled size="28"></td> </tr> </table> <br> <table border="0" cellspacing="0" cellpadding="0"> <br /> <br /> <br /> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> Fullt Navn: </td><td width="240"> <INPUT TYPE="text" NAME="name" size="28"></td></tr> <tr height="8"> <td width="86" height="8"></td> <td width="240" height="8"></td> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> Adresse: </td><td width="240"> <INPUT TYPE="text" NAME="address" size="28"></td></tr> <tr height="8"> <td width="86" height="8"></td> <td width="240" height="8"></td> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> Sted: </td><td width="240"> <INPUT TYPE="text" NAME="city" size="28"></td></tr> <tr height="8"> <td width="86" height="8"></td> <td width="240" height="8"></td> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table>Postnummer: </td><td width="240"> <INPUT TYPE="text" NAME="zip" size="6"></td></tr> <tr height="8"> <td width="86" height="8"></td> <td width="240" height="8"></td> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> Telefon: </td><td width="240"> <INPUT TYPE="text" NAME="phone" size="28"></td></tr> <tr height="8"> <td width="86" height="8"></td> <td width="240" height="8"></td> </tr> <tr><td align="right" width="86"> <table width="10" border="0" cellspacing="0" cellpadding="0"> <tr height="5"> <td width="20" height="5"></td> </tr> </table> E-mail: </td><td width="240"> <INPUT TYPE="text" NAME="email" size="28"></td></tr> <tr height="8"> <td width="86" height="8"> </td> <td width="240" height="8"></td> </tr> <td width="86"> <div align="right"> <br> </div> </td> <td width="240"><br /> <input type="submit" name="Submit" value="Send" /> <input type="reset" name="reset" value="Reset" /></td> </tr> </table> </form> <!--end of the form --> <!-- END THE COPYING HERE!!!!!!! --> </div> </div> </td> </tr> </table> </td> </tr> </table> </div> </td> </tr> </table> </td> </tr> <tr height="61"> <td width="757" height="61" ALT="" valign="top" background="../../bilder/hoved_design/bottom.jpg"> <table width="757" height="47" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="copy" width="360" valign="top"> <div style="margin-top:4px; margin-right:90px " align="center"> <div class="copy"> <font color="white">Copyright 2005-2007 © Noram Produkter A/S<br /> Design og utvikling av nettside - <a href="http://www.cloevvold-photo.com/" target="_blank">Cecilie Løvvold</a></font></div> </div> </td> <td align="center" width="397"> <div align="center" style="margin-top:26px " class="bot_men"> <div class="bottom_links"> <div class="bot_men"> </div> </div> </div> </td> </tr> </table> </td> </tr> </table> <!-- End ImageReady Slices --><br /> <br /> </body> </html> And <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Noram Produkter A/S - Ventilasjon På Naturens Vilkår</title> <link rel="stylesheet" href="../../css/lightbox.css" type="text/css" media="screen" /> <script src="../../js/prototype.js" type="text/javascript"></script> <script src="../../js/scriptaculous.js?load=effects" type="text/javascript"></script> <script src="../../js/lightbox.js" type="text/javascript"></script> <style type="text/css"> #lightbox, #overlay { z-index:10000 !important; } </style> <link href="../../css/style.css" rel="stylesheet" type="text/css" media="all" /> </head> <body> <!-- ImageReady Slices (1_home.psd - Slices: 01, 03) --> <table width="759" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="759" height="566" ALT="" valign="top" bgcolor="#FFFFFF"> <table width="759" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="white" width="271" height="566" valign="top" alt="" style="background-position:bottom; background-repeat:no-repeat " background="../../bilder/hoved_design/buisness.jpg"><img src="../../bilder/hoved_design/logo.jpg" alt="" height="69" width="271" usemap="#logo16be78b" border="0" /><map name="logo16be78b"><area shape="rect" coords="27,14,243,58" href="../../index.html" alt="" /></map></td> <td width="488" height="566" alt="" valign="top" style="background-position:top right; background-repeat:no-repeat " background="../../bilder/hoved_design/girl.jpg"> <table width="488" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <menumachine name="mainmenu" id="m17wmfia"> <csobj t="Component" csref="../../menumachine/mainmenu/menuspecs.menudata"><noscript> <p><a class="mm_no_js_link" href="../../menumachine/mainmenu/navigation.html">Site Navigation</a></p> </noscript> </csobj> <script type="text/javascript"><!-- var mmfolder=/*URL*/"../../menumachine/",zidx=1000; //--></script> <script type="text/javascript" src="../../menumachine/menumachine2.js"></script> <script type="text/javascript" src="../../menumachine/mainmenu/menuspecs.js"></script> </menumachine> </td> </tr> </table> <div style="margin-left:31px; margin-top:24px; width:340px "> <br /> <br /> <img src="../../bilder/hoved_design/ventilasjon.jpg" alt="" width="232" height="20" border="0" /><br /> <br /> </div> <div style="margin-top:20px "> <table width="486" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td background="../../bilder/hoved_design/red_td.jpg" width="486" height="33" ALT="" valign="top"> <div style="margin-top:1px "> <table width="486" height="32" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="background-position:right; background-repeat:repeat-y " colspan="2" valign="top" width="486"> <div style="margin-left:29px; margin-top:12px "> <span class="bot_men"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Bestilling</font></b></span></div> </td> </tr> </table> </div> </td> </tr> <tr> <td width="486" height="312" ALT="" valign="top"> <table width="486" height="407" border="0" cellspacing="0" cellpadding="0" background="../../bilder/hoved_design/px1.jpg" style="background-position:right; background-repeat:repeat-y "> <tr> <td class="box_bestill" height="407" valign="top" background="../../bilder/hoved_design/px1.jpg" style="background-position:left; background-repeat:repeat-y "> <div style="margin-top:5px "> <div class="box_bestill"> <br /> <br /> <style type="text/css" media="screen"><!-- .readonly { color: #16287c; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; } --></style> <? $produkt = $_POST['produkt']; $name = $_POST['name']; $address = $_POST['address']; $state = $_POST['state']; $city = $_POST['city']; $zip = $_POST['zip']; $country = $_POST['country']; $phone = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $fax = $_POST['fax']; $error_msg = ""; $msg = ""; if(!$name){ $error_msg .= "Your name \n"; } if($name){ $msg .= "Navn: \t $name \n"; } if(!$address){ $error_msg .= "Your address \n"; } if($address){ $msg .= "Adresse: \t $address \n"; } if($city){ $msg .= "Sted: \t $city \n"; } if(!$zip){ $error_msg .= "Your zip \n"; } if($zip){ $msg .= "Postnr: \t $zip \n"; } if(!$phone){ $error_msg .= "Your phone \n"; } if($phone){ $msg .= "Telefon: \t $phone \n"; } if(!$email){ $error_msg .= "Your email \n"; } if($email){ if(!eregi("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\._\-]+\.[a-zA-Z]{2,4}", $email)){ echo "\n<br>That is not a valid email address. Please <a href=\"javascript:history.back()\">return</a> to the previous page and try again.\n<br>"; exit; } $msg .= "E-mail: \t $email \n"; } $sender_email=""; if(!isset($name)){ if($name == ""){ $sender_name="Web Customer"; } }else{ $sender_name=$name; } if(!isset($email)){ if($email == ""){ $sender_email="Customer@website.com"; } }else{ $sender_email=$email; } if($error_msg != ""){ echo "You didn't fill in these required fields:<br>" .nl2br($error_msg) .'<br>Please <a href="javascript:history.back()">return</a> to the previous page and try again.'; exit; } $mailheaders = "MIME-Version: 1.0\r\n"; $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailheaders .= "From: $sender_name <$sender_email>\r\n"; $mailheaders .= "Reply-To: $sender_email <$sender_email>\r\n"; mail("post@cloevvold-photo.com","Bestilling av Filter til Exvent Pingvin",stripslashes($msg), $mailheaders); echo "<html>\n<head>\n<title>Noram Produkter AS</title>\n</head>\n<body><font size=2 color=#16287c face=Verdana, Arial, Helvetica, sans-serif><b>Takk for din bestilling!</b></font><br>\n";echo '<font size=1 color=#373737 face=Verdana, Arial, Helvetica, sans-serif><b>Dette er infomasjonen du sendte:</b></font>'."<br><br>\n"; echo nl2br(stripslashes($msg)); echo '<html><br><body><font size=1 color=#373737 face=Verdana, Arial, Helvetica, sans-serif>Med Vennlig Hilsen<br>Noram Produkter AS</font></body></html>'; //This is the end of the PHP code ?> </div> </div> </td> </tr> </table> </td> </tr> </table> </div> </td> </tr> </table> </td> </tr> <tr height="61"> <td width="757" height="61" ALT="" valign="top" background="../../bilder/hoved_design/bottom.jpg"> <table width="757" height="47" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="copy" width="360" valign="top"> <div style="margin-top:4px; margin-right:90px " align="center"> <div class="copy"> <font color="white">Copyright 2005-2007 © Noram Produkter A/S<br /> Design og utvikling av nettside - <a href="http://www.cloevvold-photo.com/" target="_blank">Cecilie Løvvold</a></font></div> </div> </td> <td align="center" width="397"> <div align="center" style="margin-top:26px " class="bot_men"> <div class="bottom_links"> <div class="bot_men"> </div> </div> </div> </td> </tr> </table> </td> </tr> </table> <!-- End ImageReady Slices --><br /> <br /> </body> </html> I posted the complet code here, with the html in it.. because the special caracters works when its not nested in to the html.. So something most be wrong there.. Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/ Share on other sites More sharing options...
cloevvold Posted October 31, 2007 Author Share Posted October 31, 2007 I really dont understand this.. isnt <meta http-equiv="content-type" content="text/html;charset=utf-8"/> the right thing to use.. What am i gonna do... and I am going to put this on the web today :'( Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-381817 Share on other sites More sharing options...
cloevvold Posted November 1, 2007 Author Share Posted November 1, 2007 *Bump* Isnt there someone here who cant helt me?? Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-382455 Share on other sites More sharing options...
MadTechie Posted November 1, 2007 Share Posted November 1, 2007 I don't understand what your asking.. this may fix the email problem.. $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; to $mailheaders .= "Content-type: text/plain; charset=utf-8\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-382466 Share on other sites More sharing options...
cloevvold Posted November 1, 2007 Author Share Posted November 1, 2007 Thanks.. That sorted out the message problem in the mail.. now is æøå showing like it should be. But only in the message, In the "From" field in outlook, is æøå still not showing like it should. Something to do with that? I will try to explain the other thing better.. sorry that my english isnt so good :-\ If you see in the code you will see thet I have 2 fields in the form that it set to read only these fields are called: Produkt and Betalingsmåte And the way this script works is that after the user have send the info they get a sceen up about what they filled out. And the field Produkt is not showing on that page. This is a field that the user is not suppose to be able to write something in, but I would like it to show un the top of the list, that shows what who has been filled out. I hope I explained it good enough so someone understand what I mean now ??? Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383043 Share on other sites More sharing options...
SirChick Posted November 1, 2007 Share Posted November 1, 2007 can you show me where: $produkt = $_POST['produkt']; is being echo'd i cant even find it theres so many lines i presume you have echo'd them some where cos otherwise won't show. Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383047 Share on other sites More sharing options...
darkfreaks Posted November 1, 2007 Share Posted November 1, 2007 <?php if (preg_match("[a-z]+[A-Z]æøå",$sender_email||$sender_name) { // do stuff }else { //error } ?> Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383054 Share on other sites More sharing options...
cloevvold Posted November 1, 2007 Author Share Posted November 1, 2007 In html file: </table> Produkt:</td> <td width="236"> <input class="readonly" type="text" name="produkt" value="Filter til Exvent Pingvin" disabled size="28"><br> </td> Php file: $produkt = $_POST['produkt']; $name = $_POST['name']; $address = $_POST['address']; $state = $_POST['state']; $city = $_POST['city']; $zip = $_POST['zip']; $country = $_POST['country']; $phone = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $fax = $_POST['fax']; $error_msg = ""; $msg = ""; if(!$name){ $error_msg .= "Ditt navn \n"; } if($name){ $msg .= "Navn: \t $name \n"; } if(!$address){ $error_msg .= "Din adresse \n"; } if($address){ $msg .= "Adresse: \t $address \n"; } if($city){ $msg .= "Sted: \t $city \n"; } if(!$city){ $error_msg .= "Sted \n"; } if(!$zip){ $error_msg .= "Ditt postnummer \n"; } if($zip){ $msg .= "Postnr: \t $zip \n"; } if(!$phone){ $error_msg .= "Ditt telefonnummer \n"; } if($phone){ $msg .= "Telefon: \t $phone \n"; } if(!$email){ $error_msg .= "Din E-mail \n"; } if($email){ if(!eregi("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\._\-]+\.[a-zA-Z]{2,4}", $email)){ echo "\n<br>E-mail adressen du taset inn er ikke gyldig. Vennligst <a href=\"javascript:history.back()\"><font color=#16287c><u>gå</u></font></a> tilbake til forrige side å prøv igjen.\n<br>"; exit; } $msg .= "E-mail: \t $email \n"; Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383056 Share on other sites More sharing options...
cloevvold Posted November 1, 2007 Author Share Posted November 1, 2007 <?php if (preg_match("[a-z]+[A-Z]æøå",$sender_email||$sender_name) { // do stuff }else { //error } ?> Sorry.. Im really new at this, I hope you forgive me.. Where do I Put this? Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383060 Share on other sites More sharing options...
darkfreaks Posted November 1, 2007 Share Posted November 1, 2007 sorry hun you dont need it i got it fixed make a duplicate line to allow ISO latin as well as UTF-8 you need to allow latin characters <?php $mailheaders .= "Content-type: text/plain; charset=ISO 8859-1\r\n"; $mailheaders .= "Content-type: text/plain; charset=utf-8\r\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383062 Share on other sites More sharing options...
darkfreaks Posted November 2, 2007 Share Posted November 2, 2007 <?php function cp1250_to_utf2($text){ $dict = array(chr(225) => 'á', chr(228) => 'ä', chr(232) => 'č', chr(239) => 'ď', chr(233) => 'é', chr(236) => 'ě', chr(237) => 'í', chr(229) => 'ĺ', chr(229) => 'ľ', chr(242) => 'ň', chr(244) => 'ô', chr(243) => 'ó', chr(154) => 'š', chr(248) => 'ř', chr(250) => 'ú', chr(249) => 'ů', chr(157) => 'ť', chr(253) => 'ý', chr(158) => 'ž', chr(193) => 'Á', chr(196) => 'Ä', chr(200) => 'Č', chr(207) => 'Ď', chr(201) => 'É', chr(204) => 'Ě', chr(205) => 'Í', chr(197) => 'Ĺ', chr(188) => 'Ľ', chr(210) => 'Ň', chr(212) => 'Ô', chr(211) => 'Ó', chr(138) => 'Š', chr(216) => 'Ř', chr(218) => 'Ú', chr(217) => 'Ů', chr(141) => 'Ť', chr(221) => 'Ý', chr(142) => 'Ž', chr(150) => '-'); return strtr($text, $dict); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383189 Share on other sites More sharing options...
darkfreaks Posted November 2, 2007 Share Posted November 2, 2007 okay so we got the function working but it doesnt work in the headers hmm ??? im not sure if utf8_encode would work hmmm Quote Link to comment https://forums.phpfreaks.com/topic/75461-help-with-a-contact-form/#findComment-383287 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.