Jump to content

[SOLVED] Newbie Help with Form Mail


RobScotland

Recommended Posts

Hello to you all....If someone could help me with this I would be most grateful I have looked through the forum and to be honest I dont know what Im looking at..so sorry if this topic has been covered.

 

I have a small website that I want to put  contact form on. I was given a simple php script by my webspace provider...It sends an emal address and a message the user submits...which is fine....but i want to add more....I have tackled the HTML side of things ok..

How can I expand on this even if I knew how to add one more item that would be  great help. I have tred many different things and I get nothing..

This is the script provided to me...

 

<?php

 

mail("[email protected]", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST", "-f".$_REQUEST);

 

header( "Location: http://www.themcdonaldguesthouse.co.uk/thankyou.html" );

 

?>

 

 

Thanks for any help in advance.....Rob

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/51755-solved-newbie-help-with-form-mail/
Share on other sites

Try this

 

 

form.html

Code:

<HTML>
    <head>
        <title>
            Form
        </title>
    </head>
    <body>
        <form action="mail.php" method="POST">
            <input name="name">
            <br><input name="email">
            <br><input name="phone">
            <br><input type="submit" value="Send!">
        </form>
    </body>
</HTML>

 

mail.php

<?php
    $email = "[email protected]";
    $subject = "Contact Form";
    $message = "Name: ".$_POST['name'];
    $message .= "\nEmail Adress: ".$_POST['email'];
    $message .= "\nTelephone: ".$_POST['phone'];
    $message = addslashes($message);
    mail($email, $subject, $message);
    echo("Thankyou for filling out the Form!");
?>

 

 

 

on a side note, in your code replace

 

$_REQUEST[message] with {$_REQUEST['message']}

and

$_REQUEST with {$_REQUEST['email']}

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.