Jump to content

I'm working on a website right now and the last significant thing I want to do is add the ability to send emails.

 

I have a form setup with all the required fields and thought my send.php file was going to work, but it didn't...

 

html form

                    <form method="post" action="send.php">                        <div class="row half">                            <div class="6u"><input type="text" name="name" id='name' placeholder="Name"/></div>                            <div class="6u"><input type="text" name="email" id='email' placeholder="Email"/></div>                        </div>                        <div class="row half">                            <div class="12u">                                <textarea name="message" id='message' placeholder="Message"></textarea>                            </div>                        </div>                        <div class="row">                            <div class="12u">                                <input type="submit" value="Send Message"/>                            </div>                        </div>                    </form>

php file it uses send.php

<?php	if(isset($_POST['submit'])) {		$msg = 'Name: ' . $_post['name'] ."\n"			.'Email: ' /$_post['email'] . "\n"			.'Message: ' /$_post['message'];		mail('example@hotmail.com', 'Steves Auto', $msg);	} else {		header('location: index.html#contact');		exit(0);	}?>
Link to comment
https://linustechtips.com/topic/230486-php-mailing/
Share on other sites

Link to post
Share on other sites

First thing I noticed, couldn't get the see submit in the post request, so I gave the <input type="submit"> a name of submit as well. I also changed the PHP file as such:

<?php	if(isset($_POST['submit'])) {		$msg = 'Name: ' . $_POST['name'] ."\n" /*Capitalised the "posts" */			.'Email: ' . $_POST['email'] . "\n"			.'Message: ' . $_POST['message'];/* Changed the slashes to fullstops */		mail(example@[member='Example'].com, 'Steves Auto', $msg);	} else {		header('location: email.php?test=fail');//Oh, and change this back to what is was		exit(0);	}?>

@prolemur

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to comment
https://linustechtips.com/topic/230486-php-mailing/#findComment-3154347
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×