Jump to content

wigglesby

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wigglesby's Achievements

Member

Member (2/5)

0

Reputation

  1. It seems to display all the html when HTML email is disabled. How could I change the code I provided to send html or plain text?
  2. function sendEmail($to, $subject, $body, $errorText="") { $sendSuccess = 0; $body = str_replace("\n","<br/>",$body); $footer = "<div style='clear:both;'></div>" ."<p style='display:block;text-align:left;border-top:solid 1px #cccccc; padding-top:10px; margin-top:25px;'>" ."Visit: <a href='".WEBSITE_ADDRESS."'>".WEBSITE_ADDRESS."</a><br/>" .WEBSITE_POSTAL_ADDRESS.'<br/>' .WEBSITE_CONTACT_NUMBERS.'<br/>' ."Terms and Conditions: <a href='".WEBSITE_ADDRESS."/terms.php'>Terms and Conditions</a><br/>" ."Contact: <a href='mailto:".EMAIL_FROM_WEBSITE."'>".EMAIL_FROM_WEBSITE."</a><br/>" ."Company Registration: xxx VAT Number: xxx<br/>" ."</p>"; if(EMAIL_SENDING_STATUS == 1)//Check if we are sending emails from the site { //$emailHeaders = "To: The Receiver <".$to.">\n" . $emailHeaders = "From: ".EMAIL_FROM_WEBSITE."\r\n". "Content-type: text/html\r\n"; $header = "" ."<head>" ."<style type=\"text/css\">" ."body {\n" ." font: 11px/1.5em \"Lucida Grande\",\"Nimbus Sans Medium\",Arial,sans-serif;\n" ." color:#333333;\n" ." }\n" ." .maindiv\n" ." {\n" ." width:550px;\n" ." padding:5px;\n" ." padding-top:0px;\n" ." border:solid 1px #333333;\n" ." margin-bottom:25px;\n" ." }\n" ." .mailbody\n" ." {\n" ." padding-bottom:5px;\n" ." margin-bottom:10px;\n" ." }\n" ." .bodyImg\n" ." {\n" ." border:solid 1px #cccccc;\n" ." padding:3px;\n" ." }\n" ." td\n" ." {\n" ." vertical-align:top;\n" ." }\n" ."</style>" ."</head>"; $logoHead = ""; //"<p style='display:block;text-align:right;border-bottom:solid 1px #cccccc;margin-bottom:25px;'><img title='www.example.co.uk' alt='xx logo' src='http://www.example.co.uk../images/look_feel/logo.png' /></p>"; //If not an error send to site contact if($errorText == "") { if(!@mail($to, $subject, "<html>".$header."<body><div class='maindiv'>".$logoHead."<div class='mailbody'>".$body."</div>".$footer."</div></body></html>", $emailHeaders)) $sendSuccess++; }else //else send to webmaster { if(!@mail(EMAIL_WEBMASTER , WEBSITE_NAME." ".$subject ,"<html>".$header."<body><div class='maindiv'>" .$logoHead ."<div class='mailbody'>" ."============".WEBSITE_NAME." ERROR =============<br/>" .date("l jS \of F Y h:i:s A")."<br/>" .$this->curPageURL()."<br/>" ."-----------------------------------------------------------------------------------<br/>" .$body."<br/>" .$errorText ."</div>" .$footer ."</div></body></html>" , $emailHeaders)); $sendSuccess++; } } else { $emailString = "<p>TO: ".$to."</p>" ."<p>SUBJECT: ".$subject."</p>" ."<p>BODY: ".$body."</p>" .$footer .($errorText != '' ? "<p>ERROR: ".$errorText."</p>" : ''); echo $emailString; } return ($sendSuccess == 0 ? true : false); } Some users seem to only get the email in terms of the code displaying and not rendering the HTML properly.
  3. Hi all I'm trying to send email via PHP and some of the emails are returning as: > >> Content-type: text/html >> >> Message-Id: <[email protected]> >> Date: Mon, 19 Apr 2010 10:05:15 +0100 (BST) >> Return-Path: [email protected] >> X-OriginalArrivalTime: 19 Apr 2010 09:05:16.0672 (UTC) FILETIME= >> [6DB2F800:01CADF9F] >> It doesn't seem to send the email properly. Can anyone shed any light on why it would be doing this?
  4. Hi All I'd really like it so that If someone types www.mydomain.com then they are redirected to www.mydomain.co.uk Is this possible with a .htaccess file? Thanks
  5. I haven't called a PHP function in my JS. updateReceivedCartons() is another JS function: <script type="text/javascript" /> jQuery.noConflict(); function updateReceivedCartons(){ var cartons = jQuery('input#txtitemscarton<? echo $recId ?>').val(); var remaining = jQuery('input#txtitemsremaining<? echo $recId ?>').val(); var received = jQuery('input#txtitemsreceived<? echo $recId ?>').val(); var gTotal = cartons - remaining; var html = '<input type="text" onblur="updateRemainingCartons()" id="txtitemsreceived<? echo $recId ?>" name="txtitemsreceived<? echo $recId?>" class="teenyinput numbers" value="'+gTotal+'" />'; if (gTotal < 0) { alert("The number you entered is too large."); } else { jQuery("#txtitemsreceived<? echo $recId ?>").after(html).remove(); } } </script> <script type="text/javascript" /> jQuery.noConflict(); function updateRemainingCartons(){ var cartons3 = jQuery('input#txtitemscarton<? echo $recId ?>').val(); var remaining3 = jQuery('input#txtitemsremaining<? echo $recId ?>').val(); var received3 = jQuery('input#txtitemsreceived<? echo $recId ?>').val(); var gTotal2 = cartons3 - received3; var html = '<input type="text" onblur="updateReceivedCartons()" id="txtitemsremaining<? echo $recId ?>" name="txtitemsremaining<? echo $recId?>" class="teenyinput numbers" value="'+gTotal2+'" />'; if (gTotal2 < 0) { alert("The number you entered is too large."); } else { jQuery("#txtitemsremaining<? echo $recId ?>").after(html).remove(); } } </script> Thanks
  6. Hi I have written some code, that calculates the value of one input box minus another input box and then puts the sum into another input box. This works fine if there is only 1 row (the page uses php to loop through the db), with only 3 boxes. If there is another table row (i.e. another 3), the code doesn't seem to update but the row below does. <script type="text/javascript" /> jQuery.noConflict(); jQuery(document).ready(function() { var cartons2 = jQuery('input#txtitemscarton<? echo $recId ?>').val(); var received2 = jQuery('input#txtitemsreceived<? echo $recId ?>').val(); var remaining2 = jQuery('input#txtitemsremiaining<? echo $recId ?>').val(); var gRemaining = cartons2 - received2; var gReceived = received2; var html2 = '<input type="text" onblur="updateReceivedCartons()" id="txtitemsremaining<? echo $recId ?>" name="txtitemsremaining<? echo $recId?>" class="teenyinput numbers" value="'+gRemaining+'" />'; jQuery("#txtitemsremaining<? echo $recId ?>").after(html2).remove(); var html3 = '<input type="text" onblur="updateRemainingCartons()" id="txtitemsreceived<? echo $recId ?>" name="txtitemsreceived<? echo $recId?>" class="teenyinput numbers" value="'+gReceived+'" />'; jQuery("#txtitemsreceived<? echo $recId ?>").after(html3).remove(); }); </script> Above is my code: The 3 input fields have the following ids: carton number = txtitemscarton + the id of the row from the db received number = txtitemsreceived + the id of the row from the db remaining number = txtitemsremaining + the id of the row from the db So on load, it should detect the value of txtitemscarton... - txtitemsreceived and then insert the result into txtitemsremaining, but it if there are 2 or more rows, then it only replaces 1 txtitemsreceived input box. I have attached a screenshot of what I mean. Any ideas how I can change this code? Thanks [attachment deleted by admin]
  7. Hi I have following code: <script type="text/javascript" /> function updateReceivedCartons(){ var cartons = parseFloat(document.getElementById('cartons').value); var remaining = parseFloat(document.getElementById('txtitemsremaining<? echo $recId ?>').value); var received = parseFloat(document.getElementById('txtitemsreceived<? echo $recId ?>').value); var gTotal = cartons - received - remaining; if (gTotal < 0) { alert("The number you entered is too large."); } else { $("#txtitemsreceived<? echo $recId ?>").after("<td class='numbers'><input type='text' disabled='disabled' id='txtitemsreceived<? echo $recId ?>' name='txtitemsreceived<? echo $recId?>' class='teenyinput numbers' value='XXXXXX' /></td>").remove(); } } </script> cartons = 3 received =1 remaining = 1 Now when I set remaining as 1, I then want to pass in the gTotal variables value where XXXXXX is. But I'm not sure how to. So If the above values are set, XXXXXX should be 1 (3 - 1 - 1 = 1). Im just not sure how to the the value of the variable and then pass it into value="XXXXXX" Any ideas?
  8. Hi I have 2 input fields: <input type='text' name='txtitemsremaining".$recId."' id='txtitemsremaining".$recId."' class='teenyinput numbers' value='' /> <input type='text' disabled='disabled' id='txtitemsreceived".$recId."' name='txtitemsreceived".$recId."' class='teenyinput numbers' value='".$poItem->items_received."' /> The form Is in 3 parts: Remaining (input field) Received (input field) Total (outputs the total from the db) What I want to do is: If the total is 6 and received is 0, then remaining needs to say '6'. If I then type in 3 into remaining, I need it to update the received value to 3. If then saved, the page should then display remaining as 3, received as 3 and total as 6. If i then type 0 into remaining, then received should say 6. I just dont know how to do this with javascript and ajax. Thanks
  9. Oh yeah Cheers everyone!
  10. Ok, so it works for some but not others: if (get_magic_quotes_gpc()) { $good_practice = stripslashes($_POST['good_practice']); $investment_return = stripslashes($_POST['investment_return']); } else { $good_practice = $_POST['good_practice']; $investment_return = $_POST['investment_return']; } $good_practice = mysql_real_escape_string($_POST['good_practice']); $investment_return = mysql_real_escape_string($_POST['investment_return']); On output it will still output the following: it\'s Any idea why? Thanks
  11. Ok: echo get_magic_quotes_gpc(); Returned 1, so I guess magic quotes is turned on.... $json_out = nl2br($mtj->get_json()); This seemed to work as well. Cheers guys
  12. Ok, I'm using: $content = mysql_real_escape_string($_POST['content']); To insert the text. Do I need to add stripslashes before the real_escape_string function? $content = stripslasges(mysql_real_escape_string($_POST['content'])); The code: $json_out = stripslashes(nl2br($mtj->get_json())); didn't work Thanks
  13. Hi I have some data in my db, which is inserted into a form. As some of the text is in " it's " with single quote, it inserts with a \' into the db. This is all fine, the problem is I'm wanting to use nl2br, which finds all the \r\n and outputs a break. But this still outputs the it\'s string. I have the following: $json_out = nl2br(stripslashes($mtj->get_json())); But using stripslashes removes the \ form the it\'s but then outputs the rn minus theri slashes. Anyway I can round this? Thanks
  14. That is quite possible. The insert of the data uses mysql_real_escape_string. Could this be a reason why, when inserting a string, such as "example-code" then outputs "\\\example-code\\\" ? Thanks
  15. Can anyone help me with this? It's causing a problem parsing the JSON as it cannot parse the JSON due to the \\ chars UPDATE: I've added stripslashes to the way the json is generated. Fingers crossed no more errors on parsing.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.