0

EDIT: What I have tried is a php thing i found online:

$user = "$email";

$usersubject = "Uw reservering bij Cantrijn";
$userheaders = "From: stagiair@cantrijn.nl \n"; 

$usermessage = "Bedankt $naam voor uw reservering \n 
 U heeft gereserveerd: $product . \n 
 De datum dat u uw reservering ophaalt is: $datumop 
 De datum om de reservering uiterlijk terug te brengen is: $datumterug  
 Locatie: $locatie \n";

@mail($user,$usersubject,$usermessage,$userheaders); 

I don't know if I need a mailserver for it or a simple program/script will work, but here it goes.

On our site we have reservation form to lend laptops, beamers etc. from the workplace. When they inserted their information and the info we require the order is set and placed in the database.

It would be nice if we could then automatically send them a mail with that info in it, so they can Always look in there to see when they have to bring it back or when they wanted to pick it up.

The html code I have is as follows:

<form method="post">
    <h3>Naam:</h3>
    <input required name="naam" type="text" placeholder="Voer naam in"><br />
    <h3>E-Mail:</h3>
    <input required name="email" type="text" placeholder="E-Mailadres"><br />
    <h3>Ophaaldatum</h3>
    <input required name="datumop" type="date">
    <h3>Datum vergadering</h3>
    <input required name="datumverg" type="date">
    <h3>Datum Terugbrengen</h3>
    <input required name="datumterug" type="date">
    <h3>Product</h3>
    <input type="text" name="product">
    <h3>Locatie</h3>
    <select name="locatie">
    <option value="Gorinchem">Gorinchem</option>
    <option value="Utrecht">Utrecht</option>
    </select>
    <br /><br />
    <input type="submit" value="Reserveren">

And with my php i get it out and into the DB. Is there a way to get this into an e-mail, so when the user clicks reserve, they get the info?

I thank you all for your efforts to help me and my not so bright html/php mind.

ThisIsNotArmand
  • 99
  • 2
  • 14

1 Answers1

1

In the part that you enter the info to Database which I assume is a PHP file, add a send email function of course after successfull insertion to table.

Give the needed parameters, format your message and send it tothe email address of the user.

function sendEmail($subject,$toEmail,$message){
  $headers = 'From: webmaster@example.com' . "\r\n" .
             'Reply-To: webmaster@example.com' . "\r\n" .
             'X-Mailer: PHP/' . phpversion();

  mail($toEmail, $subject, $message, $headers);
}

This should do the job for you.

If your server is providing email services then it should be totally fine. Just be sure you are sending the parameters correctly to the email function.

CntkCtn
  • 357
  • 2
  • 7
  • Thanks, I'm currently testing it with Xampp, but I don't think that provides email services does it? – ThisIsNotArmand Sep 16 '15 at 12:29
  • Depends on your version and settings and OS. I also have xampp and email sending works on my local. You can try with using your own email address as receiver and see. If it does not work then you can read this post and figure out the proper settings. http://stackoverflow.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhost – CntkCtn Sep 16 '15 at 12:31
  • Much thanks, i'll go and try it out – ThisIsNotArmand Sep 16 '15 at 12:36
  • On it's own it doesn't work so now i'll try the link, again, much thanks for helping us out. Mostly it's just downvotes because they think it's a noob question. – ThisIsNotArmand Sep 16 '15 at 12:43
  • Now it is not. This platform is for helping people to learn not to make them feel bad cause they ask questions which are easy for others. There are a lot of people who does not know that. Although you can improve the way of asking questions of course :) – CntkCtn Sep 16 '15 at 12:46