Jump to content

Email form help


omahony

Recommended Posts

Why isn't this working?! It does everything except send the email to me.

I know it's probably something simple that I'm missing, but I can't figure it out.

Can anyone lend a hand?

 

form code

<form  method ="post" name="leaguerequest" action="testPHP.php">
<table border="0" cellpadding="2">
    
    <tbody>
        <tr>
            <td>Name:</td>
            <td><input type="text" name="name" size="25px" /></td>
        </tr>
        <tr>
            <td>Email:</td>
            <td><input type="text" name="email" size="25px" /></td>
        </tr>
        <tr>
            <td>Phone:</td>
            <td><input type="text" name="phone" size="25px" /></td>
        </tr>
        <tr>
            <td>Message:</td>
            <td><textarea name="message" rows="4" cols="20"></textarea></td>
        </tr>
        <tr>
            <td></td>
            <td align="right"><input type="submit" value="Submit" name="submit" /></td>
        </tr>
    </tbody>
</table>
</form>

 

 

php code

<?php 

if (isset($_POST["submit"])){
    $youremail = '[email protected]';
    $fromsubject ='League Information Request';
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $message = $_POST['message'];

        $to = $youremail;
        $mailsubject = $fromsubject;
        $body = $fromsubject.'
            Contact Name: '.$name.'
            Phone Number: '.$phone.'
            Email: '.$email.'
            Message: '.$message.'

            End of message';

   mail($to, $email, $body);
  
}
else {

    echo "Please check the form and re-submit.";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/206806-email-form-help/
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.