Jump to content

Webform don't send data to email


hassan1214

Recommended Posts

Hello,

 

I need help on webfrom code . As I have mentioned email address into action= filed but not getting any email data on the prescribed email address. www.icampk.com please check contact page for ref.

<h3 class="p2">Contact Form</h3>
            <form id="contact-form" action="action="/Default.aspx?A=Form&Email=info@icampk.com&Subject=This+is+email+subject&EmailFrom=info@icampk.com&PageID=/index.html"" method="post" enctype="multipart/form-data">
              <fieldset>
                <label><span class="text-form">Your Name:</span>
                  <input name="p1" type="text">
                </label>
                <label><span class="text-form">Your Email:</span>
                  <input name="p2" type="text">
                </label>
                <label><span class="text-form">Subject:</span>
                  <input name="p3" type="text">
                </label>
                <div class="wrapper">
                  <div class="text-form">Your Message:</div>
                  <div class="extra-wrap">
                    <textarea></textarea>
                    <div class="clear"></div>
                    <div class="buttons"> <a class="button" href="#">Clear form</a> <a class="button" href="#">Send message</a> </div>
Link to comment
Share on other sites

Can you share with us the PHP code? THe code that you use to send the e-mail

 

I'm looking you html and:

"<textarea></textarea>" here you write your mensaje, but, you have not set a "name".

 

You should write:

<textarea name="message"></textarea>

 

And then, in PHP code, use $_POST['"message"]

Link to comment
Share on other sites

Wait wait wait wait...

First, you ahve very mucho problems.

 

Look... I'm in your site, and I go to the file when you process your e-mail (http://www.icampk.com/contact-form-handler.php) and I'm seen that:

You have not support to PHP in your server... else, we should not see the PHP code.

 

That is your PHP code:

$errors = '';
$myemail = 'info@icampk.com';
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['subject']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['p1'];
$email_address = $_POST['p2'];
$email_address = $_POST['p3'];
$message = $_POST['message'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}

if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n ".
"Email: $email_address\n Message \n $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}

And, look the first lines...

if(empty($_POST['name']) ||

and bla bla bla...

 

Is obviolsy that... $_POST['name'] is EVERYTIME empty, because $_POST['name'] not exist... only exist $_POST['p1']

 

All that is is empty:

if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['subject']) ||
empty($_POST['message']))

 

You should modify that... replace "name" for "p1", and "email" for "p2" and bla bla bla.

 

Then i see:

$message = $_POST['message'];

But, $_POST['message'] is not existing! remember add "name=message" at your <textarea>

 

And then, you use: mail($to,$email_subject,$email_body,$headers); but, $email_body is a string defined for your... You should use "$message"...

 

Please, dont copy and past code for others site... is better learn about PHP, read about PHP, read examples, but NEVER COPY AND PAST... I have very much experience with PHP and when I copy and past, EVERYTIME have problems.

 

If you continue having problems, report us here.

Link to comment
Share on other sites

Remember:

if( empty($errors))

is FASLE becasuse that is TRUE:

if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['subject']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}

 

and then, your code not send the e-mail.

Edited by BrodaNoel
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.