ponies3387 Posted February 1, 2008 Share Posted February 1, 2008 I created a form in dreamweaver that includes -a text box -a file upload -three check boxes -submit button. heres the code for it: <form action="process.php" method="post" enctype="multipart/form-data" name="Form" class="style1" id="Form"> <div align="left"> <blockquote> <p><span class="style11">E-mail: </span> <input type="text" name="Email" id="Email" /> <br /> <span class="style6">I have text here</span><br /> <br /> <br /> <span class="style11"> Image:</span> <input type="file" name="Image" id="Image" /> <br /> <br /> <br /> <span class="style12">more text here</span><br /> <br /> <input type="checkbox" name="1" id="1" /> standard retouch <br /> <span class="style6">blah blah checkbox</span><br /> <input type="checkbox" name="2" id="2" /> anothercheckbox description<br /> <input type="checkbox" name="3" id="3" /> last checkbox<br /> <br /> More options will be added in the near future!<br /> <br /> <br /> <input type="submit" name="Submit" id="Submit" value="Submit" /> <span class="style6">final text</span><br /> <br /> </p> </blockquote> </div> </form> Heres the script I created for it: <?php $email = $_REQUEST['Email'] ; $file = $_REQUEST['Image'] ; $check1 = $_REQUEST['1'] ; $check2 = $_REQUEST['2'] ; $check3 = $_REQUEST['3'] ; $submit = $_REQUEST['Submit'] ; mail( "info@changedforprivacy.com", "New Sent Photo", $message, "From: $email" ); header( "Location: http://www.changedforprivacy.com/SendSuccess.html" ); ?> As you can see, I want the results e-mailed to me since thats the only way I know how, and I want only myself to see it. So far, my script sends me a blank e-mail. Any help is appreciated, this is my first one ever, and im having a lot of trouble understanding this. I also here that you have to make your script secure, and I have no clue how to do that. Ive looked at so many tutorials, and im just not getting it. ??? Please help me make my script work the way it should!! Quote Link to comment Share on other sites More sharing options...
revraz Posted February 1, 2008 Share Posted February 1, 2008 You don't seem to be putting anything in $message to send to yourself. Quote Link to comment Share on other sites More sharing options...
nathan1 Posted February 1, 2008 Share Posted February 1, 2008 yup, there is no message field, so your not posting any message, you also dont have anything to pick it up, sooo make a message input field and get a $message to pick up the message post, then it should be good. Quote Link to comment Share on other sites More sharing options...
ponies3387 Posted February 1, 2008 Author Share Posted February 1, 2008 ??? okkk...so im confused what you mean...do I have to create a message area in the form itself in dreamweaver? because I dont want to allow users to write a message, I just want to be emailed the results. Im really new to this, what do I write and where do I write it!???? also, how do I make it secure??? Quote Link to comment Share on other sites More sharing options...
ponies3387 Posted February 2, 2008 Author Share Posted February 2, 2008 okkk...so I changed my script to this: but it still doesnt work. If anyone can give me some more specific ways to fix this, that would be helpful, I dont know what im doing obviously. <?php $email = $_REQUEST['Email'] ; $file = $_REQUEST['Image'] ; $check1 = $_REQUEST['1'] ; $check2 = $_REQUEST['2'] ; $check3 = $_REQUEST['3'] ; $submit = $_REQUEST['Submit'] ; $message = " Email address = $email Checkbox1 = $check1 Checkbox2 = $check2 Checkbox3 = $check3"; mail( "info@changed.com", "New Sent Photo", $message, "From: $email" ); header( "Location: http://www.changed.com/SendSuccess.html" ); ?> :'( Quote Link to comment Share on other sites More sharing options...
budimir Posted February 2, 2008 Share Posted February 2, 2008 Did you try to test your mail() function and check if it's working? It needs to be setup! Quote Link to comment Share on other sites More sharing options...
AndyB Posted February 2, 2008 Share Posted February 2, 2008 ... but it still doesnt work Please be specific. "Doesn't work" isn't telling us what the problem is. Do you get no email? Do you get a blank email? etc.,etc. Quote Link to comment Share on other sites More sharing options...
ponies3387 Posted February 3, 2008 Author Share Posted February 3, 2008 Heres what happens: I get an e-mail that looks like this: Email address = person@hotmail.com Checkbox1 = Checkbox2 = on Checkbox3 = which is good, but my form also has a send file field, and that is not being e-mailed to me. Quote Link to comment Share on other sites More sharing options...
nathan1 Posted February 3, 2008 Share Posted February 3, 2008 ahh i get you, you want the results of the check box to be emailed to you ayyz.... well what you have to do is something like this (its a contact form i made up, i commented it so you can understand it a bit better okayz); <?php //if the contact form was posted run the following if (isset($_POST['Subject'])) { //the email and name im getting from a session but you could get it from a text box etc $email = $_SESSION['email']; $name = $_SESSION['name']; $subject = $_POST['Subject']; //if you are using a checkbox just use $_POST whatever the checkbox name is $message = $_POST['Message']; //this does a little check to make sure that they are using a real email add-makes it a bit more secure (if your really worried you can use gpl image captcha but i wouldnt worrie unless its large scale. if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) { //if its not real echo out a wrong email msg echo "<h2>Enter valid e-mail</h2>\n "; $badinput = "<h2>Email was NOT submitted</h2></div> \n"; echo $badinput; echo "<br>"; include('footer.php'); //then just kills the page die(); } //if the form is all correct email the message to the following $to = 'name@whatever.com'; $header = "from:$name <$email>"; //then just put the message together, if your message is a few checkboxes instead of using $message just use the seperate boxes then just construct the $message, eg: $message = $box1 $box2; $success = mail($to, $subject, $message, $header); if ($success) { //success message echo 'Thank you for your question/feedback.'; } else { //fail message echo "Email could not be sent $to."; } } else { ?> <table width="50%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <form action="" method="post"> <table width="328" height="183" border="0" align="center" cellspacing="0"> <tr> <td valign="top">Subject</td> <td><label> <input name="Subject" type="text" class="text" id="Subject" size="25" /> </label></td> </tr> <tr> <td valign="top">Message</td> <td><label> <textarea name="Message" cols="23" rows="8" class="text" id="Message"></textarea> </label></td> </tr> </table><div align="center"><input name="Submit" type="submit" class="text" value="Send" /></div> </form> </td> </table></font> <?php } ?> Good luck Quote Link to comment Share on other sites More sharing options...
ponies3387 Posted February 3, 2008 Author Share Posted February 3, 2008 thanks, but I still have a problem with the browse file field not send the image the user send to my e-mail. But thanks for the security help! The checkboxes work fine, I just cant figure out how to allow the user to send a file in the e-mail! If anyone can show me whats wrong with my form/script which is not sending me the browse file field input, I would really really appreciate it!!! Quote Link to comment Share on other sites More sharing options...
nathan1 Posted February 4, 2008 Share Posted February 4, 2008 hey its a bit complex....have a look at this; http://planetozh.com/blog/my-projects/php-send-file-by-email-sendmail-attachment/ 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.