Need help with basic PHP for contact form, all the help is appriciated
Hi,
I'm new to the IT world so please bear with me. Ive been at this problem for 10 hours and I like finding answes on my own but I admit do failure.
I have this html code for the contact form;
<form class="contact_form" action="kontakt.php" method="post">
<p><input type="text" required="required" id="contact_name" name="contact_name" class="text_input" value="" size="22" />
<label for="contact_name">Namn *</label></p>
<p><input type="text" required="required" id="contact_company" name="contact_company" class="text_input" value="" size="22" />
<label for="contact_company">Företag *</label></p>
<p><input type="email" required="required" id="contact_email" name="contact_email" class="text_input" value="" size="22" />
<label for="contact_email">Epost *</label></p>
<p><textarea required="required" name="contact_content" class="textarea" cols="30" rows="5"></textarea></p>
<p><button type="submit" class="button white"><span>Skicka</span></button></p>
<input type="hidden" value="info@webelite.se" name="contact_to"/>
</form>
Now the problem is that it apears I suck at PHP, the best I could do was get the form to send emails but they where all blank.
This is all the php I could gather;
<?php
$contact_name = $_POST['contact_name'];
$contact_company = $_POST['contact_company'];
$contact_email = $_POST['contact_email'];
$contact_content = $_POST['contact_content'];
$mail_to = 'info@webelite.se';
$subject = 'Lilla form '.$field_name;
$body_message = 'From: '.$contact_name."\n";
$body_message .= 'E-mail: '.$contact_email."\n";
$body_message .= 'Message: '.$contact_content;
$headers = 'From: '.$contact_email."\r\n";
$headers .= 'Reply-To: '.$contact_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
<?php
}
?>
I really need the PHP ready so please help me....
Thank you
