Jump to content

Need some form help


kotkoda

Recommended Posts

Hello,

 

I am new to php. Hopefully it is not a difficult thing what I need.

I will have a simple form with first name, last name and email address (and submit, reset) button.

What I need is that the form would send a specific set text together with the fist name and last name to the specified email address. However, I think where the problem lies (or maybe not) is that the message received from the form should look like it came from the Email address of the one filled out the form. (It is a listserv that would receive the message from the form - so it has to be very exact. ) No subject needed all the message has to be in the body...

 

Can anyone help me with this?

Link to comment
Share on other sites

I have another problem (different, simple form):

 

Why this does not send back ALL the info from the form? I assume this is the problem:  $name, $message, $email ); but how do I correct it? (I need the form send back name, email, message - that's all in the form itself).

 

v<?php

  $name = $_REQUEST['name'] ;

  $email = $_REQUEST['email'] ;

  $message = $_REQUEST['message'] ;

 

  mail( "blablabla@gmail.com", "Comment from website",

    $name, $message, $email );

?>

Link to comment
Share on other sites

<?php
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['message'] ;
  $msg = "Name: $name\nEmail: $email\nMessage: $message";

  mail( "blablabla@gmail.com", "Comment from website", $msg );
?>

Link to comment
Share on other sites

From what I can make out of you're objective is that you want the user to enter their e-mail address, and you want the e-mail being sent to appear as if it came from the e-mail address they entered? Assuming this is true, you obviously have an input field for them to enter their e-mail address.

 

From that just do something similar to:

 

mail("blablabla@gmail.com", "Comment from website", $message, "From:" . $email); // $email being the variable which stores the post data.

Link to comment
Share on other sites

^ I've had issues on my server sending emails with the "From" header not corresponding to my domain. But it may work for him...

 

Odd, did you set the server up yourself? I've often had mail problems because of typos in the configuration files.

Link to comment
Share on other sites

A lot of hosting services have started blocking outgoing email where the FROM header is set to an outside domain. Basically they don't want people to use their servers for phishing.

 

Understandable, I suppose if I was in their position I wouldn't want it either.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.