Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7218255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:27:29+00:00 2026-05-28T21:27:29+00:00

Hi i am a newbie to php and am following this tutorial http://tutorialpot.com/2011/06/fancy-contact-form-with-inline-validation/#comment-1771 i

  • 0

Hi i am a newbie to php and am following this tutorial

http://tutorialpot.com/2011/06/fancy-contact-form-with-inline-validation/#comment-1771

i am wondering where do i put in my email address so users can send a email to me

thanks in advance

 <?php 
function checkLen($str,$len=2) //&len definens the minimun length of the input fields
{
    return isset($_POST[$str]) && mb_strlen(strip_tags($_POST[$str]),"utf-8") > $len;
}
function checkEmail($str)
{
    return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);
}
foreach($_POST as $k=>$v)
{
$_POST[$k]=stripslashes($_POST[$k]);

$_POST[$k]=htmlspecialchars(strip_tags($_POST[$k]));
}
//session names must be same with that in contact form      
session_name("tpot_contact");
@session_start();
if (isset($_POST['send'])){ 
$err = array();
if(!checkLen('name'))
    $err[]='The name field is too short or empty!';
if(!checkLen('email'))
    $err[]='The email field is too short or empty!';
else if(!checkEmail($_POST['email']))
    $err[]='Your email is not valid!';
if(!checkLen('subject'))
    $err[]='You have not selected a subject!';
if(!checkLen('message'))
    $err[]='The message field is too short or empty!';
if((int)$_POST['captcha'] != $_SESSION['expected'])
    $err[]='Wrong security code!';
if(count($err))
{
        $_SESSION['errStr'] = implode('<br />',$err);
        header('Location: '.$_SERVER['HTTP_REFERER']);
        exit();
    }
    //submission data
        $IP=$_SERVER['REMOTE_ADDR'];
        $name=$_POST['name'];
        $email=$_POST['email'];
        $date=(gmdate(" Y/m/d "));
         $time = date('H:i:s');  
        $message=$_POST['message'];
            $from="noreply@tutorialpot.com";
            $subject =  " from ".$_POST['name']." | contact form";
            $headers = "From: ".$from."\r\n";
            $headers .= "Reply-to: ".$from."\r\n";
            $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
            //checks whether send to my email address is set
            if ($cc == 1) {
             $headers .= 'Cc:'. $_POST['email']."\r\n";
                          } 
        $msg =
          "<p><strong>Name: </strong>" .$name. "</p> 
          <p><strong>Email Address: </strong>" .$email. "</p> 
          <p><strong>Enquiry: </strong>" .$_POST['subject']. "</p> 
          <p><strong>Message: </strong>" .$message. "</p>
          <br/> <br/>
          <p>This message was sent from the IP Address:" .$ipaddress." on".$date. "at".$time."</p>";
             if(@mail($email, $subject, $msg, $headers))
             {
        $success=array();
        $success[]='Your message has been sent! | Thank you';
        $_SESSION['sent'] = implode('<br />',$success);
         header('Location: '.$_SERVER['HTTP_REFERER']);
         exit();
            }
    else{
    $err[]='your message could not be sent due to a network problem please try again.!';
    $_SESSION['errStr'] = implode('<br />',$err);
    header('Location: '.$_SERVER['HTTP_REFERER']);
    exit();
    }
}
?>

  <div class="fieldContainer"> 
    <label for="name" >*Name: </label>
    <input class="validate[required,minSize[3]] input1" id="name" name="name" type="text" autofocus="autofocus"  placeholder="NAME"/><br /><br />
    <label for="email">*Email</label>
    <input class="validate[required,custom[email]] input1" id="email" name="email" type="text"  placeholder="EMAIL"  /><br /><br />
      <label for="subect" >*Subject</label>
      <select  id="dropdown4" name="subject" class="validate[required] input1">
        <option  selected="selected" value="">--Choose--</option>
        <option value="Quote">Quote</option>
        <option value="Suggestion">Suggestion</option>
        <option value="Question">Question</option>
        <option value="Business Proposal">Business Proposal </option>
        <option value="Advertising">Advertising</option>
        <option value="Complaint">Complaint</option>
        <option value="Other">Other</option>
      </select><br /><br />
    <label for="message" >*Message</label>
    <textarea rows="10" cols="15" name="message" class="validate[required,minSize[3],maxSize[300]]  input1" id="message" placeholder=" MESSAGE CONTENTS"></textarea><br /><br />

      <legend>*Human Verification (HELP US FIGHT SPAM)</legend>
      <label for="captcha">25+9=</label>
    <input type="text" class="validate[required,custom[integer]] input1 " name="captcha" id="captcha" maxlength="2" placeholder="DO A LITTLE MATH" />
 <p> 
      <input type='checkbox' id='cc' name='cc' value='1'  />
      Send a copy to your email address
      </p>
  </div>
  <div class="signupButton">
 <input  name="send" type="submit" class="btnsubmit" id="btnsubmit" />
    <!--<input class="blackb" type="submit"  name="send"  id="submit"/>-->
  </div>

</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:27:29+00:00Added an answer on May 28, 2026 at 9:27 pm

    It is this section that sends the message as mail returns bool. The first paramters is the to address (see link)

    if(@mail($email, $subject, $msg, $headers))
    

    http://php.net/manual/en/function.mail.php

    In the example the email will go to the address the user enters as seen as $email is populated with the posted value

    $email=$_POST['email'];
    

    but you can hardcode to what ever you want.

    if(@mail('youremail@domain.com', $subject, $msg, $headers))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey, I am a newbie in symfony. I am following this joobet tutorial on
I am newbie to PHP I have written the following program: $address=array('abc@gmail.com','abc@hotmail.com','def@yahoo.com'); foreach($address as
I'm a fairly newbie php coder, got this php code in a tutorial to
I have the following URL: http://somedomain.com/aa/search/search.php I want it to return 2 selections, that
I'm a real newbie with php and MySQL. Now I'm working on the following
I am a newbie at PHP; today I see some code as the following
I'm completely newbie in PHP. I have tried example code from this site .
I am a newbie to PHP development. I tried following code sample from PHP5
I'm a PHP newbie, so I have a minor problem functions. I have this
Hello everyone I am a newbie to php and this is my first ever

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.