Jump to content

[SOLVED] Fancy a (simple) challenge?


markarma

Recommended Posts

Hi

 

The following code works perfectly well on my site, hosted by Streamline.net, however I've been trying for about 3 days to simply add a 'Your Name' field and also send that info to my inbox, it just doesn't work. ANy help much appreciated!

 

HTML...

 

<FORM method=post action="sendmail.php">

 

Email: <br>

<INPUT name="email" type="text"><br>

 

Message:<br>

<TEXTAREA name="message"></textarea><br>

 

<input type=submit>

</FORM>

 

PHP...

 

<?php

 

mail("[email protected]",

"This is the subject of the email",

 

"Message: " .$_REQUEST[message]."\n",

 

"From: " .$_REQUEST,

"-f".$_REQUEST);

 

header( "Location: http://www.markarma.com" );

 

?>

 

Thanks,

 

Mark

 

Link to comment
https://forums.phpfreaks.com/topic/154335-solved-fancy-a-simple-challenge/
Share on other sites

try this XHTML strict option for your html and better formatting for your php

 

HTML

<form method="post" action="sendmail.php">
Your Name: <br />
<input type="text" name="YourName" />
Email: <br />
<input name="email" type="text"><br>

Message: <br />
<textarea name="message"></textarea><br>

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


<?php
$to = "[email protected]"; 
$subject = "This is the subject of the email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>";
$message .= "Message From:";
$message .= $_POST["YourName"];
$message .= "Message:";
$message .= $_POST["message"];
$message .= "From: ";
$message .= $_POST["email"];
$message .= "
</body>
</html>
";// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <$email>' . "\r\n";

mail($to,$subject,$message,$headers);

header( "Location: http://www.markarma.com" );
exit();

?>

ok can you do the below changes

 

echo "<p>This is the Message:".$message."</p>";

 

 

//header( "Location: http://www.markarma.com" );

exit();

 

where commenting out the header so we can see whats posted from the message

 

can you post the output of this is the message..

 

Thanks

Thanks for everyones help, I did a search within the forum and found what I was looking for by searching for 'streamline.net'.

 

http://www.phpfreaks.com/forums/index.php/topic,189288.0.html

 

I was able to borrow ;) and edit the code discussed on the page.

 

Cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.