andrew_U Posted March 28, 2008 Share Posted March 28, 2008 i can't seem to find to problem with this php script. file1: advertise.html <html> <head> <title>TundraIRC Advertise</title> </head> <body> If you wish to Advertise on this website please fill out the following form and the Website Director will get back to you ASAP: <form action="advertise.php" method="POST"> <b>First Name</b><br/> <input type="text" name="firstname" size=40 /><br/> <b>Last Name:</b> <input type="text" name="lastname" size=40 /><br /> <b>Company</b><br/> <input type="text" name="company" size=40 /><br/> <b>Email</b><br/> <input type="text" name="email" size=40 /><br/> <b>Website Address</b><br/> <input type="text" name="website" size=40 /><br/> <input type="submit" value=" Send "> </form> file2: advertise.php <html> <head> </head> <body> <?php $email = $_POST['email']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $company = $_POST['company']; $website = $_POST['website']; if (mail('email@email.com' , 'TundraIRC Advertisements','Someone wants to adveritse on tundraIRC: ' . $fistname . ' ' . $lastname . ' ' . $company . ' ' . $website . ' ' . $email)) { echo "<h4>Thank you for sending email</h4>"; } else { echo "<h4>Can't send email to $email</h4>"; } ?> </body> </html> when you click "submit" from the first file no information is recieved in the email. how do i fix this? **email@email.com is an example of the email used Quote Link to comment Share on other sites More sharing options...
ucffool Posted March 29, 2008 Share Posted March 29, 2008 From PHP.NET as reference: <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('caffinated@example.com', 'My Subject', $message); ?> You are using single quotes around variables, when I assume you wanted to actually send the value of the variable, not the name of the variable literally. <?php // for readability: $subject = 'TundraIRC Advertisements'; $message = "Someone wants to advertise on tundraIRC: $firstname $lastname $company website $email"; if (mail($email , $subject,$message)) { echo "<h4>Thank you for sending email</h4>"; } else { echo "<h4>Can't send email to $email</h4>"; }?> At this point, you should see one of the two echo commands since mail() returns TRUE if there was nothing wrong with the function's request to send the email, but that doesn't confirm the email will actually reach its destination. Quote Link to comment Share on other sites More sharing options...
andrew_U Posted March 29, 2008 Author Share Posted March 29, 2008 never mind i fixxed it with this: $subject = 'TundraIRC Advertisements'; $message = "Someone wants to advertise on tundraIRC: $firstname $lastname Company: $company Website: $website Email: $email"; $email1 = 'email@email.com'; if (mail($email1 , $subject,$message)) { echo "<h4>Thank you for sending email</h4>"; } else { echo "<h4>Can't send email, try again later</h4>"; }?> thanks for the advice though ? 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.