Status
Not open for further replies.

coolboyz2323

Active Member
1,798
2011
639
125
heyy

i m receiving blank message on my email from contact form of some site.

html content:

Code:
<!-- contact form start -->
          <div class="contactForm" id="contactForm">
            <form id="contact">
              <fieldset>
                <label for="contactName" id="name_label">Name (required)</label>
                <input type="text" name="contactName" id="contactName" size="30" value="" class="text-input" />
                <label for="contactEmail" id="email_label">Email (required)</label>
                <input type="text" name="contactEmail" id="contactEmail" size="30" value="" class="text-input" />
                <label for="contactSubject" id="subject_label">Subject</label>
                <input type="text" name="contactSubject" id="contactSubject" size="30" value="" class="text-input" />
                <label for="contactMessage" id="message_label">Message (required)</label>
                <textarea  name="contactMessage" id="contactMessage" class="text-input"></textarea>
                <p>
                  <input type="submit" name="submitMessage" class="contactButton" id="contactSubmitBtn" value=""/>
                </p>
              </fieldset>
            </form>
          </div>
          <!-- contact form end -->



mail.php content:

Code:
<?php
if (isset($_POST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_POST['email'] ;
$name = $_POST['name'] ;
  $subject = $_POST['subject'] ;
  $contactMessage = $_POST['contactMessage'] ;
$header = '';
$header .= "Reply-To: $name <$email>\r\n"; 
    $header .= "Return-Path: $name <$email>\r\n"; 
    $header .= "From: $name <admin@cb-gfx.com>\r\n"; 
    $header .= "Organization: CB-Graphics\r\n"; 
    $header .= "Content-Type: text/plain\r\n"; 
  mail("divyap_31@yahoo.com", $subject,
  $contactMessage, $header);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  contactMessage:<br />
  <textarea name='contactMessage' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
  
  
  
  ?>


Plz help me to fix this!

THanks!
 
6 comments
Did your setup your server for mail to work
You will need a mail cilent

actually this other site is on same hosting where my cb-gfx.com is up, & contact form of cb-gfx.com works very fine so i guess it shud also work ?

Thanks!

---------- Post added at 06:37 PM ---------- Previous post was at 06:34 PM ----------

is above coding is 100% ok?
 
PHP:
<?php
if (isset($_POST['contactEmail']))
	{
	$email = $_POST['contactEmail'] ;
	$name = $_POST['contactName'] ;
	$subject = $_POST['contactSubject'] ;
	$contactMessage = $_POST['contactMessage'] ;
	$header  = "Reply-To: $name <$email>\r\n"; 
	$header .= "Return-Path: $name <$email>\r\n"; 
	$header .= "From: $name <admin@cb-gfx.com>\r\n"; 
	$header .= "Organization: CB-Graphics\r\n"; 
	$header .= "Content-Type: text/plain\r\n"; 
	mail("divyap_31@yahoo.com", $subject, $contactMessage, $header);
	echo "Thank you for using our mail form";
	}
else
	{
	echo "<form method='post' action='mailform.php'>
	Email: <input name='contactEmail' type='text' /><br />
	Subject: <input name='contactSubject' type='text' /><br />
	contactMessage:<br />
	<textarea name='contactMessage' rows='15' cols='40'>
	</textarea><br />
	<input type='submit' />
	</form>";
	}
?>


You should add form validation
 
PHP:
<?php
if (isset($_POST['contactEmail']))
	{
	$email = $_POST['contactEmail'] ;
	$name = $_POST['contactName'] ;
	$subject = $_POST['contactSubject'] ;
	$contactMessage = $_POST['contactMessage'] ;
	$header  = "Reply-To: $name <$email>\r\n"; 
	$header .= "Return-Path: $name <$email>\r\n"; 
	$header .= "From: $name <admin@cb-gfx.com>\r\n"; 
	$header .= "Organization: CB-Graphics\r\n"; 
	$header .= "Content-Type: text/plain\r\n"; 
	mail("divyap_31@yahoo.com", $subject, $contactMessage, $header);
	echo "Thank you for using our mail form";
	}
else
	{
	echo "<form method='post' action='mailform.php'>
	Email: <input name='contactEmail' type='text' /><br />
	Subject: <input name='contactSubject' type='text' /><br />
	contactMessage:<br />
	<textarea name='contactMessage' rows='15' cols='40'>
	</textarea><br />
	<input type='submit' />
	</form>";
	}
?>


You should add form validation

& how to do that bro?

i wish it was possible to do that in illustator :D

plz help! Thanks!
 
You should be able to to quite easy integrate recapcha . Check their wiki. On phone otherwise would do it for you
 
You should be able to to quite easy integrate recapcha . Check their wiki. On phone otherwise would do it for you

You can do it when @ Home! no huriez!

THanks a lot!

---------- Post added 30th Sep 2012 at 08:03 AM ---------- Previous post was 29th Sep 2012 at 07:35 PM ----------

FixEd!!!! Thanks everyone
 
Status
Not open for further replies.
Back
Top