PHP Email Form

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Hi,
Does anyone know how to create a PHP form that emails the result? Will it work with x10's intermediate PHP version? If someone could just post a simple form, I'd really appreciate that.
Also, if anyone knows of a good Joomla extension that has forms, please let me know.
Thanks!
:)
 

taekwondokid42

New Member
Messages
268
Reaction score
0
Points
0
Yes, the mail function should work on the intermediate lvl of x10hosting.

<?php
$mailto = "email@address";
$subject = "$_POST['subject']";
$headers = "From: email@email";
$body = "$_POST['body']";
mail($mailto, $subject, $body, $headers);
?>


This should work.
 
Last edited:

de.monkeyz

New Member
Messages
35
Reaction score
0
Points
0
if you want a full html it should go like this.


PHP:
<?php

if(isset($_POST['msg']))
{
       $msg = $_POST['msg'];
       $from = $_POST['from'];
       $to = $_POST['to'];
       $title = $_POST['title'];

       mail($to, $title, $msg, "From:$from");
}

?>

<form name=mail method='POST' action='./'>
From:<input type=text name=from />
To: <input type=text name=to />
Title: <input type=text name=title />
Msg:<textarea name="msg" cols="45" rows="5"></textarea>
</form>
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
All right, so you put the PHP stuff before the HTML.
Is that a form where you type something in, click Submit and you get an email about it?
 
Top