Jayden_Blade Posted December 2, 2013 Share Posted December 2, 2013 (edited) it is sending me the email but sends $email, $subject, $message. not the actual values. errors = startpost startedlost1Notice: Undefined index: email in /home/jayden1/public_html/contactusemail.php on line 10spot = emaillostNotice: Undefined index: email in /home/jayden1/public_html/contactusemail.php on line 20Notice: Undefined index: subject in /home/jayden1/public_html/contactusemail.php on line 21Notice: Undefined index: message in /home/jayden1/public_html/contactusemail.php on line 22 contactusemail.php <?php error_reporting(E_ALL); $check = array('email','subject','message'); echo "lost1"; $break = false; foreach ($check as $key => $postcheck) { if (!$_POST[$postcheck] || strlen($_POST[$postcheck]) == 0) { $break = true; break; } echo 'not blank'; } if (isset($_POST)){ $email1 =($_POST['email']); $subject1 =($_POST['subject']); $message1 =($_POST['message']); echo $email1; echo $subject1; echo $message1; $to = 'Administrator@website.com'; // Send email to Administrator $subject = '$subject1'; // posted subject $message = '$message1'; // Their message $headers = 'From:$email1' . "\r\n"; // Set from headers mail($to, $subject, $message, $headers); // Send our email $msg = 'Your message has been sent!'; header ('contact.php'); } else { echo 'not working'; } ?> contact.php <?php session_start(); if (!$_SESSION || !$_SESSION['login']) { //redirect to a login page header('Location: index.php'); exit; } else { include ("navigate.php"); } ?> <html> <head> <title> Contact Us </title> <link type="text/css" rel="stylesheet" href="style.css" /> </head> <body> <div id="info_wrapper"> <table align="center" width="1100px"> <tr> <td width="220px" align="center"> <a href="home.php">Home</a> </td> <td width="220px" align="center"> <a href="myhome.php">My Home Page</a> </td> <td width="220px" align="center"> <a href="profile.php">My Profile</a> </td> <td width="220px" align="center"> <a href="msearch.php">Member Search</a> </td> <td width="220px" align="center"> <a href="logout.php">Logout</a> </td> </tr> </table> <h1 align="center"> Contact Us </h1> <table align="center" width="1100px"> <tr> <td width="366px" align="center"> <a href="missionstatement.php">Mission Statement</a> </td> <td width="366px" align="center"> <a href="adviceblog.php">Advice Blog</a> </td> <td width="366px" align="center"> <a href="storycorner.php">Story Corner</a> </td> </tr> </table> <table align="center" width="1100px"> </br> <tr> <td width="550px" align="center"> <a href="newmembers.php">New Members</a> </td> <td width="550px" align="center"> <a href="chat.php">Community Chat Rooms</a> </td> </tr> </table> </br></br></br> <table align="center" id="table2"> <tr> <form action="contactusemail.php" method="post" enctype="text/plain" align="center" > </tr> <tr> <td> Your E-Mail: </td> <td> <input type="text" name="email" value=""><br> </td> </tr> <tr> <td> Subject: </td> <td> <input type="text" name="subject" value=""><br> </td> </tr> <tr> <td colspan="2"> <br> <textarea name="message" rows="8" cols="50"> </textarea><br><br> </td> </tr> <tr> <td> </td> <td> <input type="submit" value="Submit"> </td> </tr> </form> </table> </br></br></br> <p chat> Instant Messages and Online friends here </p chat> </br></br></br> <table align="center" width="1100px"> <tr> <td> <a href="tos.php">Terms of Service</a> </td> <td> <a href="suggestionbox.php">Suggestion Box</a> </td> </tr> <tr> <td> <a href="privacy.php">Privacy Policy</a> </td> <td> <a href="problem.php">Report a Problem</a> </td> </tr> <tr> <td> <a href="contact.php">Contact Us</a> </td> </tr> </table> </div> </body> </html> help??? Edited December 2, 2013 by Jayden_Blade Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/ Share on other sites More sharing options...
DrTrans Posted December 2, 2013 Share Posted December 2, 2013 mail($to, $subject1, $message1, $headers); // Send our email < don't need to redeclare variables... Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460923 Share on other sites More sharing options...
Jayden_Blade Posted December 2, 2013 Author Share Posted December 2, 2013 made no difference Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460932 Share on other sites More sharing options...
cyberRobot Posted December 2, 2013 Share Posted December 2, 2013 Variables don't work in single quotes. Change lines like this: $subject = '$subject1'; To $subject = "$subject1"; Or even this $subject = $subject1; Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460957 Share on other sites More sharing options...
Jayden_Blade Posted December 2, 2013 Author Share Posted December 2, 2013 startpost startedlost1Notice: Undefined index: email in /home/jayden1/public_html/contactusemail.php on line 10spot = emaillostNotice: Undefined index: email in /home/jayden1/public_html/contactusemail.php on line 20Notice: Undefined index: subject in /home/jayden1/public_html/contactusemail.php on line 21Notice: Undefined index: message in /home/jayden1/public_html/contactusemail.php on line 22 changed quotes no difference Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460958 Share on other sites More sharing options...
Solution cyberRobot Posted December 2, 2013 Solution Share Posted December 2, 2013 Try removing the following from your <form> tag: enctype="text/plain" When I tested your form code, the attribute seems to prevent the form from passing the data. Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460959 Share on other sites More sharing options...
Jayden_Blade Posted December 2, 2013 Author Share Posted December 2, 2013 Sweet!!!!!!! +1 for you sir! thanks so much! Quote Link to comment https://forums.phpfreaks.com/topic/284439-email-contact-page/#findComment-1460960 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.