PHP Help :(

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

First off i have hardly used php at all, so go easy on all the jargan :)

All I need is a very very simple PHP script that will collect the contents of a form from my site and send it to an email address i specify. I'm not worried about any complex validation or anything like that. If anyone can help, well, i'll owe you a cookie! :)

thanks
 
QUOTE=joeyjojo]This sort of thing? It's very simple, no need for nasty scripts.
Code:
<html>
<head>
<?php

$boxone = $_POST["boxone"];
$anotherbox = $_POST["anotherbox"];

$message = '
<html>
<head>
  <title>Title of message</title>
</head>
<body>' . $boxone . '<br>' . $anotherbox . '</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
   
// Additional headers
$headers .= 'To: Your Name <toaddressgoeshere>' . "\r\n";
$headers .= 'From: Your name <[email protected]>' . "\r\n";

mail(To name, "Email subject", $message, $headers);
</head>
<body>Email sent</body>
</html>
May or may not work, ask if you don't understand. Good luck :)[/QUOTE]


Thanks for the replies. For the above code, can i test it using say 3 of my fields, as i have several on the actual page....
 
robmiller said:
Won't work and is horrifyingly insecure sorry joeyjojo

Well as the site is only a bit of a project i'm not too worried about security. I gave up anyway after trying the preg_math function, but the pattern syntax really started to annoy me (and make my head hurt :( ) so i just need a very very simple script, that just sends the contents of a form to a specified email - nothing more or less :)

Hopefully, the one that guy provided will work, not tried yet :)
 
Back
Top Bottom