Jump to content

steve m

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

steve m's Achievements

Member

Member (2/5)

0

Reputation

  1. I need help. I can't seem to figure this out. I made a form where when submitted, it will email me and two others to notify us that someone is requesting some information. Well, when somebody tries to submit the form, we get an email from our web host say that the mail was undeliverable - "BAD_HEADER: Improper use of control character (char 0D hex): From: some_email_adress@example.com\r\n". I can't for the life of me figure out why this is happening. I've looked at the code and it seems to look all right. Is there something wrong in the code? <?php $To = preg_replace("/\r/", "", $_POST['email']); $To = preg_replace("/\n/", "", $_POST['email']); $headers = "From: $To\r\n"; $headers .= "Reply-To: $To\r\n"; $headers.= "Return-Path: info@rcubed.com\r\n"; $headers .= "CC: $rmail_2, $rmail_3\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1"; mail($rmail_1, $Subject, $Message, $headers); ?>
  2. Thanks everyone! I took the adive from all of you and upgraded to PHP5 and it is working now. Thanks again!
  3. Ok, I will try that and see if I don't run into any errors. I probably be back if I run into problems. Thanks Wildteen88.
  4. Since Apache 2.2 doesn't work with PHP4, should I go ahead and remove Apache 2.2 and in stall Apache 2.0? Or in your opinion install PHP5, Apache 2.2, and MySQL 5?
  5. Hi All, I just bought a new laptop and it has Windows Vista Home Premium. I'm new to installing PHP, MySQL, and Apache, so I was wondering; can PHP, MySQL, and Apache work on Vista? I was able to load Apache 2.2.3 on there and it seems to work. It's when I try to install PHP 4.4.3 I try to start the Apache server and it comes up with an error "can't load module "C:/php/sapi/php4apache.dll". I've also tried using php4appache2.dll but no success. So I'm not sure if I need to be using a particular version of these programs. Do I need to use a particular version?
  6. Sorry if I'm confusing you. What I want to do is get rid of newline characters from input fields from forms. I was told to use preg_replace() to achieve that. So if I echoed the varible it still would have the "\n".
  7. Oh sorry, I'm trying to match or replace a new line character. Would the code below work for trying to match or replace a new line character? <?php preg_match("/\n/i", $strip_text); ?>
  8. Thanks for replying back. I tried it and that didn't work either. For some reason that backslash is not being recognized literal character. Am I not escaping the backslash right?
  9. Hello, I am kind of new to regular expressions and I've been trying to get this script to work, but it won't. I can't figure out why it doesn't work. This is just a test script, but I want the preg-match() to find "\n". The \n is posted through a form, and it seem like the preg_match() function is not reading the \ before the n, because it always comes up false. Am I doing something wrong here? I've tried several different ways to the pattern and nothing is working for me. <?php $strip_text = stripslashes($_POST["preg_text"]); if(preg_match("/(n)/i", $strip_text)) { echo "It matched"; } else { echo "Did not Match"; } ?>
  10. I tried the stripslashes() before the preg_replace() and it still won't remove the \n.
  11. Hi effigy, I think magic quotes are on. So do do I need to run the POST variable through stripslashes() first?
  12. Hi rajivgonsalves, I tried that and it still doesn't remove the \n, \t, or \r. Am I not ecaping those characters right?
  13. Hello, I am having a problem trying to use the preg_replace() function. I have a form and I want to remove "new line(\n)", tabs(\t), carriage returns(\r) etc.. from the data being submitted, but it doesn't seem to work. <?php $str = preg_replace("/\n/", '' ", $_POST[email]); echo $str; ?> It doesn't seem to do anything. For example, if the email field is submitted with test@test.com\n and I print $str, it prints test@test.com\\n. Can someone please tell me what I am doing wrong?
  14. Hello, I have a question on how to pass information from a form. I am building a simple order form for this site. I am not using a database because the person that this is for doesn't want to use a database. On the form I built a function to display the different type of products taken from the array. Each product has a Qty box and when I loop the array I put a counter in it so I can name the Qty, type, and price fields. Example: qty0, type0, price0 - qty1 etc... <?php function ListDonuts() { $flavors = array(Glazed => "0.76", Chocolate => "0.80", White . " " . Sprinkles => "1.20", Chocolate . " " . Sprinkles => "1.25", Red . " " . Velvet => "2.00", Peanutbutter . " " . Chocolate => "2.50"); $item_count = count($flavors); echo $item_count; $i = 1; $j = 0; $columns = 2; foreach($flavors as $type => $price) { if($i == $columns) { $class = "class='form-colb'"; $i = 1; } else { $class = "class='form-cola'"; $i++; } $showTypes .= "<div $class> <p class='dis-donut-list'> <input class='input-box' type='textbox' name='qty$j' value='$qty' size='1' /> <input type='hidden' name='type$j' value='$type' /> <input type='hidden' name='price$j' value='$price' /> <input type='hidden' name='item_count' value='$item_count' /> $type -- $$price </p> </div>\n"; $j++; } return $showTypes; } ?> All this is fine until I submit the form. I want to be able to only select the product items that have a quantity in the qty field. This is where I am coming up blank. I've tried making the "qty" field an array (qty[]) (this is not in the above function)and then doing a foreach loop to pull the information, but I don't know how to pass the "type" and "price" values to the qty[] array to display it on the confirmation page or to save it to a CSV file. So that is why I came up with the above function. I thought I could just name the those fields with the counter and get the info that way, but I want to efficient about that and not have a lot of IF statements depending on how many items are in the array, because that number can change. Would any body be able to help me with this problem? Am I making this harder than it really is? I am totally having a brain freeze! Thanks!
  15. Thanks a lot! That worked great. Thanks again effigy.
×
×
  • 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.