email on submit

the mail() function

Moderators: macek, egami, gesf

zeeba42
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Sep 11, 2012 9:23 am

email on submit

Postby zeeba42 » Tue Sep 11, 2012 9:25 am

I need to also email out what ever was typed into the text area. I can't seem to figure it out I am really new to php.

Code: Select all


<?php

function make_content_file($filename,$content,$opentype="w"){
    $fp_file = fopen($filename, $opentype);
    fputs($fp_file, $content);
    fclose($fp_file);

}



$filename = "outage.txt";

if($_POST){
 $newcontents=$_POST[newcontents];
 make_content_file($filename,$newcontents);

}



$filecontents = file_get_contents($filename);



?>



<form method="post">

<textarea name="newcontents" cols="30" rows="3">

<?php
if($_POST)
{
echo 'Message posted!';
   
   
}
?>

</textarea>
<br>

<input type="submit" value="Update"> 
</form>


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: Google [Bot] and 2 guests