خرید بک لینک

Vote count: 0

I have a form on my website and I am trying to get it to email me whenever someone submits it. Currently, when I click submit, it just redirects me to a blank page.

        <form id="form_1138955" class="appnitro" method="post" action="/form/contact-form.php">
                <div class="form_description">
        <h2>Contact Us</h2>
        <p></p>
    </div>                      
        <ul >

                <li id="li_1" >
    <label class="description" for="name">Name* </label>
    <span>
        <input id="name_first" name= "name_first" class="element text" maxlength="255" size="8" value="1"/>
        <label>First</label>
    </span>
    <span>
        <input id="name_last" name= "name_last" class="element text" maxlength="255" size="14" value="1"/>
        <label>Last</label>
    </span> 
    </li>           <li id="li_3" >
    <label class="description" for="email">Email*</label>
    <div>
        <input id="email" name="email" class="element text medium" type="text" maxlength="255" value="1"/> 
    </div> 
    </li>       <li id="li_4" >
    <label class="description" for="phone">Phone*</label>
    <span>
        <input id="phone_123" name="phone_123" class="element text" size="3" maxlength="3" value="1" type="text"> -
        <label for="phone_123">(###)</label>
    </span>
    <span>
        <input id="phone_456" name="phone_456" class="element text" size="3" maxlength="3" value="1" type="text"> -
        <label for="phone_456">###</label>
    </span>
    <span>
        <input id="phone_7890" name="phone_7890" class="element text" size="4" maxlength="4" value="1" type="text">
        <label for="phone_7890">####</label>
    </span>

    </li>

                <li class="buttons">
            <input type="hidden" name="form_id" value="1" />

            <input id="saveForm" class="button_text" type="submit" name="submit" value="1" />
    </li>
        </ul>
    </form> 

and

    <?php 
$errors = '';
$myemail = 'email@email.com';//<-----Put Your email address here.
if(!isset($_POST['name_first'])  || 
   !isset($_POST['name_last']) || 
   !isset($_POST['email']) || 
   !isset($_POST['phone_123']) || 
   !isset($_POST['phone_456']) || 
   !isset($_POST['phone_7890']))
{
    died('All fields are required.');      
}

$name_first = $_POST['name_first']; 
$name_last = $_POST['name_last']; 
$email = $_POST['email']; 
$phone_123 = $_POST['phone_123']; 
$phone_456 = $_POST['phone_456']; 
$phone_7890 = $_POST['phone_7890']; 

if (!preg_match(
"/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", 
$email))
{
    $errors .= "n Error: Invalid email address";
}

if( empty($errors))
{
    $to = $myemail; 
    $email_subject = "Contact form submission";
    $email_body = "You have received a new form. ".
    " Here are the details:n First Name: $name_first n Last Name: $name_last n Email: $email n Phone: $phone_123 $phone_456 $phone_7890";   
} 
?>

I dont know what I am doing wrong. Could someone please help me? I think the problem is specifically wrong with my code.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 25 خرداد 1395 ساعت: 23:40

صفحه بندی