Jump to content

feedback form


Go to solution Solved by jazzman1,

Recommended Posts

feed.php

<form action="feed1.php" method="post">
Name - <input type="text" name="name" /><br /><br />
Email - <input type="text" name="email" /><br /><br />
Subject - <input type="text" name="subject"/><br /><br />
message - <textarea rows="5" cols="10" name="message"></textarea><br /><br />
<input type="submit" value="Send mail" name="sub" />
</form>

 

 

feed1.php

 

<?php
extract($_POST);
$to="sehgal_jas@yahoo.com";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers.="From:$name<$email>";
mail($to,$subject,$msg,$headers);
echo "Message sent successfully";
?>
 

error

 

"; mail($to,$subject,$msg,$headers); echo "Message sent successfully"; ?>

 

how to solve it??

 

Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/
Share on other sites

As long as PHP is installed, you're using the right file extension (typically .php, perhaps .php5), and you're using the long open tags (<?php) then the script should work. If it isn't working then probably one (or more) of those conditions aren't being met.

Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/#findComment-1430915
Share on other sites

Take that and give us the result back if there is an error:

<?php

if (function_exists('mail')) {
    extract($_POST);
    $to = "sehgal_jas@yahoo.com";
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers.= <<<EOD
From: "$name" <$email>
EOD;
} else {
    echo 'mail() has been disabled'; exit;
}
// send message
if (mail($to, $subject, $message, $headers)) {
    echo "mail send ... OK";
} else {
    echo "mail send ... ERROR!";
}

Make sure that the "$subject" and the "$message" variables are defined!

Edited by jazzman1
Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/#findComment-1430922
Share on other sites

  • Solution

He-he, that's life php coding :)

 

So, try that:

<?php

if (function_exists('mail')) {
    extract($_POST);
    $to = "sehgal_jas@yahoo.com";
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers.= <<<EOD
From: "$name" <$email>
EOD;

// send message
    if (mail($to, $subject, $message, $headers)) {
        echo "mail send ... OK";
    } else {
        echo "mail send ... ERROR!";
    }
} else {
    echo 'mail() has been disabled';
    exit;
}

Make sure all variables are defined in proper way.

Edited by jazzman1
Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/#findComment-1430927
Share on other sites

its not showing that also... so i just changed the host.. its working great know and i got the email.. :)

 

about <<<EOD (heredoc)

what exactly it do... i search the web ,  not get clear much,,,i think it is used to write multiple lines with single(') and double quotes(") ?? is it

 

and also about this line

 

From: "$name" <$email>

Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/#findComment-1430988
Share on other sites

A here document is a special-purpose code block and allows me easily to quoting/escaping the strings effectively.

About < (<) and > (>), there are html character entities, so to display for instance a less than sign we must write: < or <

But...when you try to send emails you can use both of them, I think.  

For example:

From: "$name" <$email>

Link to comment
https://forums.phpfreaks.com/topic/278124-feedback-form/#findComment-1430996
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.