cluce Posted June 19, 2007 Share Posted June 19, 2007 can someone show me the correct syntax on how to fix my code to do this? I know what i have is not right. $date = trim(strip_tags($_POST['date'])); $lastname = trim(strip_tags($_POST['lastname'])); $middle = trim(strip_tags($_POST['middle'])); $firstname = trim(strip_tags($_POST['firstname'])); $address = trim(strip_tags($_POST['date'])); $address_continue = trim(strip_tags($_POST['address'])); $city = trim(strip_tags($_POST['address_continue'])); $state = trim(strip_tags($_POST['state'])); $zip = trim(strip_tags($_POST['zip'])); $phone = trim(strip_tags($_POST['phone'])); $alternate = trim(strip_tags($_POST['alternate'])); $email = trim(strip_tags($_POST['email'])); $position = trim(strip_tags($_POST['position'])); $referred = trim(strip_tags($_POST['referred'])); $coverletter = trim(strip_tags($_POST['coverletter'])); $resume = trim(strip_tags($_POST['resume'])); $body = " \n\n Date: "$date" \n\n Last Name: "$lastname" \n\n Middle: "$middle" \n\n First Name: "$firstname" \n\n Address: "$address" \n\n "$address_continue" \n\n City: "$city" \n\n State: "$state" \n\n Zip: "$zip" \n\n Phone Number: "$phone"' \n\n Alternate Number: "$alternate" \n\n E-Mail Address: "$email" \n\n Position: "$position" \n\n Referred by: "$referred" \n\n Cover Letter or Addtional Information: "$coverletter" \n\n Resume: "$resume""; mail ($to, $subject, $body); Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/ Share on other sites More sharing options...
Illusion Posted June 19, 2007 Share Posted June 19, 2007 You need to concat the variables , simply giving " quotes will not interpret the variables. $body="\n\n Date: ".$date."\n\n Last Name: ".$lastname."...........like that. Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/#findComment-277617 Share on other sites More sharing options...
per1os Posted June 19, 2007 Share Posted June 19, 2007 What type of tags are you trying to strip, just HTML Tags? Is there a particular reason you are trying to strip HTML Tags for an email? How do you know what you have is not right? Also remove the quotes around the strings in the body portion, it is not needed with double quotes and will throw syntax errors. Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/#findComment-277618 Share on other sites More sharing options...
cluce Posted June 19, 2007 Author Share Posted June 19, 2007 well I am not sure if I need to strip the tags but I am suspicious of someone messing with the form because I am getting blank emails sent to the assigned account. soI thought I would try something differeent. I know the form works because information is being sent but so is blank forms too. You have any ideas why I migth be getting these blank forms? I am using javascript to check for required fields. Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/#findComment-277633 Share on other sites More sharing options...
per1os Posted June 19, 2007 Share Posted June 19, 2007 What are the required fields? For the required fields I would do a php check also, just to make sure. <?php $email = isset($_POST['email'])?trim($_POST['email']):null; $error = null; if (is_null($email) || empty($email)) { $error .= "Please supply a valid email.<br />"; } ?> Do that for each required field. If $error is not null than do not send the form but revert them back explaining the error message/required fields were not populated. Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/#findComment-277641 Share on other sites More sharing options...
cluce Posted June 19, 2007 Author Share Posted June 19, 2007 yeah I guess I am being lazy i didnt want to do that but I think I will. thanks for your input........ Quote Link to comment https://forums.phpfreaks.com/topic/56207-trying-to-strip-tags-and-trim-fields-before-a-user-submits-an-email/#findComment-277664 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.