Jump to content

INSERT and EMAIL from a form post action...


Jim R

Recommended Posts

Upon submitting my form, the User is taken to dbenter.php, where it accurately inserts information into my database and redirects my User to the next step.

 

The problem I'm having is I'm not sure how to send their form results from that PHP page.  I've searched the web and here, but most of what I find are people asking about sending emails to the User.  I just want the results sent to me.

 

Thanks.

 

Link to comment
Share on other sites

Here is my PHP prowess.  :D

 

I can take what I see, make sense of it and make it really do what I want.  In calling the mail() function, I'm not sure how to make it work.  I'm heading out for now and will search later.  Is there a good place to start in seeing how it's coded?

 

Thanks.

 

Link to comment
Share on other sites

most of what I find are people asking about sending emails to the User.  I just want the results sent to me.

 

So, if you put your email address in as the To: address in an email script, wouldn't  that mean that the email would be sent to you? The point of programing is to write (or modify existing) code to accomplish a stated task. If you found an existing script that sends an email to anyone, to change it to send an email to you, you would identify the part of the code responsible for setting up the recipient and modify it to use your email address instead.

 

And the light blue text in thorpe's post is a link to the php.ini documentation that describes, with examples, how to use the mail() function.

Link to comment
Share on other sites

I can't get any of the variables to work in the $message variable.  The regular text prints in the email, but that is all.

 

 

<?php
// The message
$name = $_post['nameFirst'] . ' ' . $_post['nameLast'];
$school = $_post['school'];
$email = $_post['email'];

$message = "$name";
$message = "has entered the fall league.";


// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('basketball@metroindybasketball.com', 'Fall League Registration', $message);

 

Link to comment
Share on other sites

Try this:

 

<?php

// The message
$message =  $_POST['nameFirst'] . ' ' . $_POST['nameLast'] .'\r\n';
$message .=  $_POST['school'].'\r\n';
$message .=  $_POST['email'].'\r\n';
$message .=  $_POST['nameFirst'] . $_POST['nameLast'] ."has entered the fall league.";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('basketball@metroindybasketball.com', 'Fall League Registration', $message);

?>

Link to comment
Share on other sites

It's carrying the values, which is good, but it's not recognizing any of the spacing.  In what you provided, it just prints the /n/r.  I changed it to <br>, and it just prints that too.

 

Here is what I'm using as of the moment. 

 

<?php
// The message
$message =  $_POST['nameFirst'] . $_POST['nameLast'] ." has entered the fall league.<br>";
$message .=  $_POST['school'] . '<br>';
$message .=  $_POST['email'];

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('basketball@metroindybasketball.com', 'Fall League Registration', $message);



?>

Link to comment
Share on other sites

<br> wont effect email because they are (by default) plain text (as they should be). You need to specifically set certain headers to have email sent as html.

 

This is all covered in the link to the manual page I posted some 9 replies ago.

Link to comment
Share on other sites

<br> wont effect email because they are (by default) plain text (as they should be). You need to specifically set certain headers to have email sent as html.

 

This is all covered in the link to the manual page I posted some 9 replies ago.

 

There isn't really anything that explains when to use double vs. single quotes, nor is there anything that explains <html> is set up differently.  At least that is the case in the first parts of that page.  Hard to tell what applies as the page continues, since there is a lot of other types of codes.

 

In section 3 of the page you linked, the part marked with <html>  looks a lot like it's set up like PHP.  It's in the $message variable between single quotes. 

 

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.