Jump to content

Simple Form Help


nickb_53

Recommended Posts

I cant figure this form out, Im New to PHP

 

the form has 3 fields (name, email, and message)

I can get the form to work but cant include the name field in the results?

Ive tried to add  , $name after the $message, But this results in the from email address coming through incorrect?

sorry Im new to PHP. any help be gratefull

_________________________________________________________________________________________________

 

<form id="form1" action="sendmail3.php" method="post" enctype="multipart/form-data" name="form1">

 

Name:<div class="form">

         <input name="name" type="text" size="30">

 

E-Mail:</div>

        <div class="form">

           <input name="email" type="text" value="" size="30">

Message:</div>

          <textarea name="message" cols="33" rows="11"></textarea>

 

a href="#" class="link" onClick="document.getElementById('form1').reset()">clear</a><a href="#" class="link" onClick="document.getElementById('form1').submit()">send</a><br>

</form>

________________________________________________________________________________________________________

 

 

the sendmail3.php

 

 

<?

 

$email = $_POST['email'] ;

$message = $_POST['message'] ;

$name = $_POST['name'] ;

 

mail( "[email protected]", "Contact Request", $message, "From: $email" );

print "Congratulations your email has been sent";

?>

 

Link to comment
https://forums.phpfreaks.com/topic/107607-simple-form-help/
Share on other sites

try replacing your sendmail2.php with...

<?php
$to = "[email protected]";
$subject = "Contact Request";
$message = $_POST['message'];
$email= $_POST['email'];
$headers = 'From: $email' . "\r\n"; //<-- not sure if this one is completely right

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

 

hopefully that'll fix ur problem

Link to comment
https://forums.phpfreaks.com/topic/107607-simple-form-help/#findComment-551784
Share on other sites

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.