Steve19Ohio Posted August 19, 2008 Share Posted August 19, 2008 I want to change <? echo "<br /><br /><b>Username/email:</b><br />$name (<a href='mailto:$email'>$email</a>)"; ?> so when I click on it, it will post the email address to a e-mail form. for something like this. <? if ($_POST["email"]<>'') { $ToEmail = 'youremail@site.com'; $EmailSubject = 'Site contact form '; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?> Your message was sent <? } else { ?> <form action="test.php" method="post"> <table width="400" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="29%" class="bodytext">Your name:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td class="bodytext">Email address:</td> <td><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <td class="bodytext">Comment:</td> <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td> </tr> <tr> <td class="bodytext"> </td> <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td> </tr> </table> </form> <? }; ?> I can't seem to get it right. I want it to carry the e-mail over to the next page. that way I don't have to fill it out and I want it sent From me Support@mysite.com and Only want to be able to input the subject and body. Please help... Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/ Share on other sites More sharing options...
DeanWhitehouse Posted August 19, 2008 Share Posted August 19, 2008 make it a button or call a function Btw if ($_POST["email"]<>'') should be if ($_POST["email"] != '"') <> is ASP for != Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/#findComment-619666 Share on other sites More sharing options...
trq Posted August 19, 2008 Share Posted August 19, 2008 make it a button or call a function Btw if ($_POST["email"]<>'') should be if ($_POST["email"] != '"') <> is ASP for != <> is a perfectly valid php comparison operator. Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/#findComment-619669 Share on other sites More sharing options...
DeanWhitehouse Posted August 19, 2008 Share Posted August 19, 2008 I thought it was only ASP Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/#findComment-619671 Share on other sites More sharing options...
JasonLewis Posted August 19, 2008 Share Posted August 19, 2008 When you click it it should be GET, not POST. But I'm not sure I understand your question fully. Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/#findComment-619749 Share on other sites More sharing options...
Steve19Ohio Posted August 20, 2008 Author Share Posted August 20, 2008 Ok... I Figured out my issue... It was a lot more simple then I was making it out to be. The finishing code looked like this echo "<br /><br /><b>Username/email:</b><br />$name (<a href='adm_send_mail1.php?usrema=$email'>$email</a>)"; Then the message field was this <? require("adm_header.php"); ?> <? writeCommonAdminTable("User Administration",1);?> <html> <body> <? // Read POST request params into global vars $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; $headers = "From: $from"; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } // Send the message and error statements $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo "<p>Your E-Mail was sent to $to!</p>"; } else { echo "<p>Your E-Mail could not be sent to $to. Sorry for the inconvenience!</p>"; echo "<p>If this continues please notify $supertech.</p>"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/120280-solved-post-hyperlink-info/#findComment-621322 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.