Jump to content

Contact Form


Recommended Posts

Hi I am trying to making a contact form with php and html but it is not working plz help me......

My php and html code are following.....

 

 

HTML Code.....

 

<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="send_email.php">
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group">
<label>Name *</label>
<input type="text" name="name" class="form-control" required="required">
</div>
<div class="form-group">
<label>Email *</label>
<input type="email" name="email" class="form-control" required="required">
</div>
<div class="form-group">
<label>Phone</label>
<input type="number" class="form-control">
</div>
<div class="form-group">
<label>Company Name</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label>Message *</label>
<textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button>
</div>
</div>
</form>
PHP Code.....
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contact us. As early as possible we will contact you '
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = 'jai.5025@gmail.com';//replace with your email
$body = 'Name: ' . $name . "nn" . 'Email: ' . $email . "nn" . 'Subject: ' . $subject . "nn" . 'Message: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
Note- I am using bootstrap based template.
thanks in advance

 

Link to post
Share on other sites
  • 2 weeks later...

I want all the information in my email id which I put on php file but I am not getting any info in my email id even data (information of input box) is not submitting.

Im having the same problem , and after some really deep search i found out that the send email function doesn't work automatically with local web Servers such as (xampp, wampp. ampps .... and all other kind of "amppss out there!").

 

If you are using those kind of local servers, the mail() function won't work.

You actually have to reformat some files in the server that you are using and only than it will work ....

 

Note: As i said ..... im having the same problam with this ... and i have not tryed this things out !

however , that is what people are saying so...

Link to post
Share on other sites
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...